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.
Created attachment 107935 [details] java file reported with syntax error see attached file; essentially the following is an syntax error: public static void main(String[] args) { File f = new File("."); if (f.isDirectory()) File[] lf = f.listFiles(); } where public static void main(String[] args) { File f = new File("."); if (f.isDirectory()) { File[] lf = f.listFiles(); } } is legal editor complains; and compilation fails
Unfortunately, I cannot reproduce the problem in the current dev build (the attached java file can be opened without any syntax errors reported). What particular syntax error is reported on your side?
Created attachment 107955 [details] see red bad error message
compilation errors reported: init: Deleting: C:\Sun\JavaProjects\nb70\jf\build\built-jar.properties deps-jar: Updating property file: C:\Sun\JavaProjects\nb70\jf\build\built-jar.properties Compiling 1 source file to C:\Sun\JavaProjects\nb70\jf\build\classes C:\Sun\JavaProjects\nb70\jf\src\jf\Jf2.java:24: '.class' expected File[] lf = f.listFiles(); C:\Sun\JavaProjects\nb70\jf\src\jf\Jf2.java:24: not a statement File[] lf = f.listFiles(); C:\Sun\JavaProjects\nb70\jf\src\jf\Jf2.java:24: illegal start of expression File[] lf = f.listFiles(); C:\Sun\JavaProjects\nb70\jf\src\jf\Jf2.java:24: ';' expected File[] lf = f.listFiles(); 4 errors C:\Sun\JavaProjects\nb70\jf\nbproject\build-impl.xml:626: The following error occurred while executing this line: C:\Sun\JavaProjects\nb70\jf\nbproject\build-impl.xml:245: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds)
The red error badge is reported correctly on the following code snippet public static void main(String[] args) { File f = new File("."); if (f.isDirectory()) File[] lf = f.listFiles(); } because THERE IS a syntax error - see the Java Language Specification - 14.9 The if Statement - variable declaration cannot be used inside if-statement. Closing as invalid.