### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: batch/org/eclipse/jdt/internal/compiler/batch/messages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties,v retrieving revision 1.488 diff -u -r1.488 messages.properties --- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 17 Jan 2006 14:31:47 -0000 1.488 +++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 20 Jan 2006 16:08:17 -0000 @@ -96,15 +96,15 @@ \ -cp -classpath \n\ \ specify location for application classes and sources. Each\n\ \ directory or file can specify access rules for types between\n\ -\ ''['' and '']'' (e.g. [-X.java] to deny access to type X)\n\ +\ ''['' and '']'' (e.g. [-X] to forbid access to type X, [~X] to\n\ +\ discourage access to type X, [+p/X:-p/*] to forbid access to all\n\ +\ types in package p but allow access to p/X)\n\ \ -bootclasspath \n\ \ specify location for system classes. Each directory or file can\n\ -\ specify access rules for types between ''['' and '']'' (e.g. [-X.java]\n\ -\ to deny access to type X)\n\ +\ specify access rules for types between ''['' and '']''\n\ \ -sourcepath \n\ \ specify location for application sources. Each directory can\n\ -\ specify access rules for types between ''['' and '']'' (e.g. [-X.java]\n\ -\ to deny access to type X)\n\ +\ specify access rules for types between ''['' and '']''\n\ \ -extdirs \n\ \ specify location for extension zip/jar files\n\ \ -d destination directory (if omitted, no directory is created)\n\ @@ -136,11 +136,13 @@ \ constructorName + method with constructor name\n\ \ dep-ann missing @Deprecated annotation\n\ \ deprecation + deprecation outside deprecated code\n\ +\ discouraged + use of types matching a discouraged access rule\n\ \ emptyBlock undocumented empty block\n\ \ enumSwitch incomplete enum switch\n\ \ fieldHiding field hiding another variable\n\ \ finalBound type parameter with final bound\n\ \ finally + finally block not completing normally\n\ +\ forbidden + use of types matching a forbidden access rule\n\ \ hiding macro for fieldHiding, localHiding, typeHiding and maskedCatchBlock\n\ \ incomplete-switch same as enumSwitch\n\ \ indirectStatic indirect reference to static member\n\ Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v retrieving revision 1.225 diff -u -r1.225 Main.java --- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 17 Jan 2006 18:44:23 -0000 1.225 +++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 20 Jan 2006 16:08:17 -0000 @@ -1920,6 +1920,14 @@ this.options.put( CompilerOptions.OPTION_ReportParameterAssignment, isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + } else if (token.equals("discouraged")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportDiscouragedReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); + } else if (token.equals("forbidden")) { //$NON-NLS-1$ + this.options.put( + CompilerOptions.OPTION_ReportForbiddenReference, + isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE); } else { throw new InvalidInputException(Main.bind("configure.invalidWarning", token)); //$NON-NLS-1$ } #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v retrieving revision 1.33 diff -u -r1.33 BatchCompilerTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 16 Jan 2006 13:59:15 -0000 1.33 +++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 20 Jan 2006 16:08:19 -0000 @@ -2213,6 +2213,198 @@ false); } +// check we get appropriate combination of access rules +public void test040(){ + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + "}", + "p/Z.java", + "package p;\n" + + "/** */\n" + + "public class Z {\n" + + "}" + }, + "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p" + File.separator + "Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -nowarn" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "Y.java", + "/** */\n" + + "public class Y {\n" + + " p.X x;\n" + + " p.Z z;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + "[+p/X" + File.pathSeparator + "-p/*]\"" + + " -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + + " (at line 4)\n" + + " p.Z z;\n" + + " ^^^\n" + + "Access restriction: Z\n" + + "----------\n" + + "1 problem (1 warning)", + false); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533 +// turn off discouraged references warnings +public void test041(){ + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + "}", + "p/Z.java", + "package p;\n" + + "/** */\n" + + "public class Z {\n" + + "}" + }, + "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p" + File.separator + "Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -nowarn" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "Y.java", + "/** */\n" + + "public class Y {\n" + + " p.X x;\n" + + " p.Z z;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\"" + + " -warn:-discouraged -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + + " (at line 4)\n" + + " p.Z z;\n" + + " ^^^\n" + + "Access restriction: Z\n" + + "----------\n" + + "1 problem (1 warning)", + false); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533 +// turn off discouraged references warnings +public void test042(){ + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + "}", + "p/Z.java", + "package p;\n" + + "/** */\n" + + "public class Z {\n" + + "}" + }, + "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p" + File.separator + "Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -nowarn" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "Y.java", + "/** */\n" + + "public class Y {\n" + + " p.X x;\n" + + " p.Z z;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\"" + + " -warn:-forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/Y.java\n" + + " (at line 3)\n" + + " p.X x;\n" + + " ^^^\n" + + "Discouraged access: X\n" + + "----------\n" + + "1 problem (1 warning)", + false); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=124533 +// turn off discouraged references warnings +public void test043(){ + this.runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "/** */\n" + + "public class X {\n" + + "}", + "p/Z.java", + "package p;\n" + + "/** */\n" + + "public class Z {\n" + + "}" + }, + "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" + + " \"" + OUTPUT_DIR + File.separator + "p" + File.separator + "Z.java\"" + + " -1.5 -g -preserveAllLocals" + + " -nowarn" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "", + true); + this.runConformTest( + new String[] { + "Y.java", + "/** */\n" + + "public class Y {\n" + + " p.X x;\n" + + " p.Z z;\n" + + "}", + }, + "\"" + OUTPUT_DIR + File.separator + "Y.java\"" + + " -1.5 -g -preserveAllLocals" + + " -cp \"" + OUTPUT_DIR + "[~p/X" + File.pathSeparator + "-p/*]\"" + + " -warn:-discouraged,forbidden -warn:+deprecation,syntheticAccess,uselessTypeCheck,unsafe,finalBound,unusedLocal" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "", + false); +} + public static Class testClass() { return BatchCompilerTest.class; }