This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271673 - IllegalStateException: Cannot call getCompilationUnit() if current phase < JavaSource.Phase.PARSED. You must call toPhase(Phase.PARSED) first.
Summary: IllegalStateException: Cannot call getCompilationUnit() if current phase < Ja...
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on: 268834 271672
Blocks:
  Show dependency tree
 
Reported: 2017-10-19 20:54 UTC by theshadow27
Modified: 2018-02-05 21:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 230636


Attachments
stacktrace (1.66 KB, text/plain)
2017-10-19 20:54 UTC, theshadow27
Details
code to reproduce the problem (271.60 KB, text/plain)
2017-10-19 20:59 UTC, theshadow27
Details
stacktrace (1.66 KB, text/plain)
2017-10-19 21:02 UTC, theshadow27
Details
stacktrace (1.66 KB, text/plain)
2017-10-19 21:05 UTC, theshadow27
Details
stacktrace (1.66 KB, text/plain)
2018-02-05 21:41 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description theshadow27 2017-10-19 20:54:10 UTC
Build: NetBeans IDE 8.2 (Build 201609300101)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.144-b01, Java(TM) SE Runtime Environment, 1.8.0_144-b01
OS: Windows 10

User Comments:
theshadow27: Pasted an enormous block of generated code, probably containing errors. See also iz #271672




Stacktrace: 
java.lang.IllegalStateException: Cannot call getCompilationUnit() if current phase < JavaSource.Phase.PARSED. You must call toPhase(Phase.PARSED) first.
   at org.netbeans.modules.java.source.parsing.CompilationInfoImpl.getCompilationUnit(CompilationInfoImpl.java:220)
   at org.netbeans.api.java.source.CompilationInfo.getCompilationUnit(CompilationInfo.java:184)
   at org.netbeans.api.java.source.TreeUtilities.pathFor(TreeUtilities.java:294)
   at org.netbeans.modules.java.source.save.Reformatter.getCommonPath(Reformatter.java:378)
   at org.netbeans.modules.java.source.save.Reformatter.reformatImpl(Reformatter.java:235)
   at org.netbeans.modules.java.source.save.Reformatter.reformat(Reformatter.java:109)
Comment 1 theshadow27 2017-10-19 20:54:12 UTC
Created attachment 165319 [details]
stacktrace
Comment 2 theshadow27 2017-10-19 20:56:03 UTC
See also iz271672 and iz268834
Comment 3 theshadow27 2017-10-19 20:59:02 UTC
Created attachment 165321 [details]
code to reproduce the problem

This is the offending file...
Comment 4 theshadow27 2017-10-19 21:02:54 UTC
Created attachment 165323 [details]
stacktrace

Using large file
Comment 5 theshadow27 2017-10-19 21:05:54 UTC
Created attachment 165324 [details]
stacktrace

Trying to autoformat.
Comment 6 Exceptions Reporter 2017-10-19 21:05:58 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=230636
Comment 7 Exceptions Reporter 2018-02-05 21:41:22 UTC
Created attachment 165624 [details]
stacktrace

Opening source code file.