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.

View | Details | Raw Unified | Return to bug 225261
Collapse All | Expand All

(-)a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java (-4 / +15 lines)
Lines 822-827 Link Here
822
822
823
    private static @NonNull com.sun.tools.javac.code.Source validateSourceLevel(@NullAllowed String sourceLevel, ClasspathInfo cpInfo) {
823
    private static @NonNull com.sun.tools.javac.code.Source validateSourceLevel(@NullAllowed String sourceLevel, ClasspathInfo cpInfo) {
824
        ClassPath bootClassPath = cpInfo.getClassPath(PathKind.BOOT);
824
        ClassPath bootClassPath = cpInfo.getClassPath(PathKind.BOOT);
825
        ClassPath cmpClassPath = cpInfo.getClassPath(PathKind.COMPILE);
825
        ClassPath srcClassPath = cpInfo.getClassPath(PathKind.SOURCE);
826
        ClassPath srcClassPath = cpInfo.getClassPath(PathKind.SOURCE);
826
        com.sun.tools.javac.code.Source[] sources = com.sun.tools.javac.code.Source.values();
827
        com.sun.tools.javac.code.Source[] sources = com.sun.tools.javac.code.Source.values();
827
        Level warnLevel;
828
        Level warnLevel;
Lines 837-858 Link Here
837
                if (source.compareTo(com.sun.tools.javac.code.Source.JDK1_4) >= 0) {
838
                if (source.compareTo(com.sun.tools.javac.code.Source.JDK1_4) >= 0) {
838
                    if (bootClassPath != null && bootClassPath.findResource("java/lang/AssertionError.class") == null) { //NOI18N
839
                    if (bootClassPath != null && bootClassPath.findResource("java/lang/AssertionError.class") == null) { //NOI18N
839
                        if (srcClassPath != null && srcClassPath.findResource("java/lang/AssertionError.java") == null) {
840
                        if (srcClassPath != null && srcClassPath.findResource("java/lang/AssertionError.java") == null) {
840
                            LOGGER.log(warnLevel,
841
                            if (bootClassPath.getRoots().length != 0 ||
842
                                cmpClassPath == null ||
843
                                cmpClassPath.findResource("java/lang/AssertionError.class") == null
844
                            ) {
845
                                LOGGER.log(warnLevel,
841
                                       "Even though the source level of {0} is set to: {1}, java.lang.AssertionError cannot be found on the bootclasspath: {2}\n" +
846
                                       "Even though the source level of {0} is set to: {1}, java.lang.AssertionError cannot be found on the bootclasspath: {2}\n" +
842
                                       "Changing source level to 1.3",
847
                                       "Changing source level to 1.3",
843
                                       new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N
848
                                       new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N
844
                            return com.sun.tools.javac.code.Source.JDK1_3;
849
                                return com.sun.tools.javac.code.Source.JDK1_3;
850
                            }
845
                        }
851
                        }
846
                    }
852
                    }
847
                }
853
                }
848
                if (source.compareTo(com.sun.tools.javac.code.Source.JDK1_5) >= 0) {
854
                if (source.compareTo(com.sun.tools.javac.code.Source.JDK1_5) >= 0) {
849
                    if (bootClassPath != null && bootClassPath.findResource("java/lang/StringBuilder.class") == null) { //NOI18N
855
                    if (bootClassPath != null && bootClassPath.findResource("java/lang/StringBuilder.class") == null) { //NOI18N
850
                        if (srcClassPath != null && srcClassPath.findResource("java/lang/StringBuilder.java")==null) {
856
                        if (srcClassPath != null && srcClassPath.findResource("java/lang/StringBuilder.java")==null) {
851
                            LOGGER.log(warnLevel,
857
                            if (bootClassPath.getRoots().length != 0 ||
858
                                cmpClassPath == null ||
859
                                cmpClassPath.findResource("java/lang/StringBuilder.class") == null
860
                            ) {
861
                                LOGGER.log(warnLevel,
852
                                       "Even though the source level of {0} is set to: {1}, java.lang.StringBuilder cannot be found on the bootclasspath: {2}\n" +
862
                                       "Even though the source level of {0} is set to: {1}, java.lang.StringBuilder cannot be found on the bootclasspath: {2}\n" +
853
                                       "Changing source level to 1.4",
863
                                       "Changing source level to 1.4",
854
                                       new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N
864
                                       new Object[]{cpInfo.getClassPath(PathKind.SOURCE), sourceLevel, bootClassPath}); //NOI18N
855
                            return com.sun.tools.javac.code.Source.JDK1_4;
865
                                return com.sun.tools.javac.code.Source.JDK1_4;
866
                            }
856
                        }
867
                        }
857
                    }
868
                    }
858
                }
869
                }

Return to bug 225261