Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 179836 Details for
Bug 325342
Add new option for null analysis based on assert result.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch with doc changes
patch325342.txt (text/plain), 37.90 KB, created by
Ayushman Jain
on 2010-09-29 08:17:05 EDT
(
hide
)
Description:
patch with doc changes
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-09-29 08:17:05 EDT
Size:
37.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.compiler.tool >Index: src/org/eclipse/jdt/internal/compiler/tool/Options.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.compiler.tool/src/org/eclipse/jdt/internal/compiler/tool/Options.java,v >retrieving revision 1.13 >diff -u -r1.13 Options.java >--- src/org/eclipse/jdt/internal/compiler/tool/Options.java 24 Sep 2010 06:30:58 -0000 1.13 >+++ src/org/eclipse/jdt/internal/compiler/tool/Options.java 29 Sep 2010 12:09:48 -0000 >@@ -168,6 +168,7 @@ > || token.equals("forbidden")//$NON-NLS-1$ > || token.equals("hashCode")//$NON-NLS-1$ > || token.equals("hiding")//$NON-NLS-1$ >+ || token.equals("includeAssertNull")//$NON-NLS-1$ > || token.equals("incomplete-switch")//$NON-NLS-1$ > || token.equals("indirectStatic")//$NON-NLS-1$ > || token.equals("interfaceNonInherited")//$NON-NLS-1$ >@@ -195,7 +196,6 @@ > || token.equals("staticReceiver")//$NON-NLS-1$ > || token.equals("super")//$NON-NLS-1$ > || token.equals("suppress")//$NON-NLS-1$ >- || token.equals("suppressAssertNull")//$NON-NLS-1$ > || token.equals("syncOverride")//$NON-NLS-1$ > || token.equals("synthetic-access")//$NON-NLS-1$ > || token.equals("syntheticAccess")//$NON-NLS-1$ >#P org.eclipse.jdt.core >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.354 >diff -u -r1.354 Main.java >--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 24 Sep 2010 06:30:57 -0000 1.354 >+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 29 Sep 2010 12:09:50 -0000 >@@ -3333,7 +3333,12 @@ > } else if (token.equals("intfRedundant") /*|| token.equals("redundantSuperinterface")*/) { //$NON-NLS-1$ > setSeverity(CompilerOptions.OPTION_ReportRedundantSuperinterface, severity, isEnabling); > return; >- } >+ } else if (token.equals("includeAssertNull")) { //$NON-NLS-1$ >+ this.options.put( >+ CompilerOptions.OPTION_IncludeNullInfoFromAsserts, >+ isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); >+ return; >+ } > break; > case 'j' : > if (token.equals("javadoc")) {//$NON-NLS-1$ >@@ -3456,12 +3461,7 @@ > } else if (token.equals("super")) { //$NON-NLS-1$ > setSeverity(CompilerOptions.OPTION_ReportOverridingMethodWithoutSuperInvocation, severity, isEnabling); > return; >- } else if (token.equals("suppressAssertNull")) { //$NON-NLS-1$ >- this.options.put( >- CompilerOptions.OPTION_SuppressNullInfoFromAsserts, >- isEnabling ? CompilerOptions.ENABLED : CompilerOptions.DISABLED); >- return; >- } >+ } > break; > case 't' : > if (token.startsWith("tasks")) { //$NON-NLS-1$ >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.929 >diff -u -r1.929 messages.properties >--- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 28 Sep 2010 15:56:23 -0000 1.929 >+++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 29 Sep 2010 12:09:51 -0000 >@@ -288,6 +288,8 @@ > \ hashCode missing hashCode() method when overriding equals()\n\ > \ hiding macro for fieldHiding, localHiding, typeHiding and\n\ > \ maskedCatchBlock\n\ >+\ includeAssertNull raise null warnings for variables\n\ >+\ that got tainted in an assert expression\n\ > \ incomplete-switch same as enumSwitch\n\ > \ indirectStatic indirect reference to static member\n\ > \ intfAnnotation + annotation type used as super interface\n\ >@@ -313,8 +315,7 @@ > \ suppress + enable @SuppressWarnings\n\ > \ When used with -err:, it can also silent optional\n\ > \ errors and warnings\n\ >-\ suppressAssertNull suppress null warnings for variables\n\ >-\ that got tainted in an assert expression\n\ >+ > \ syncOverride missing synchronized in synchr. method override\n\ > \ syntheticAccess synthetic access for innerclass\n\ > \ tasks(<tags separated by |>) tasks identified by tags inside comments\n\ >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java,v >retrieving revision 1.64 >diff -u -r1.64 AssertStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 24 Sep 2010 06:30:57 -0000 1.64 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 29 Sep 2010 12:09:51 -0000 >@@ -84,9 +84,9 @@ > // expression downstream > } else { > CompilerOptions compilerOptions = currentScope.compilerOptions(); >- if (compilerOptions.suppressNullInfoFromAsserts) { >+ if (!compilerOptions.includeNullInfoFromAsserts) { > // keep just the initializations info, don't include assert's null info >- return flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()); >+ return flowInfo.addInitializationsFrom(assertInfo.nullInfoLessUnconditionalCopy()); > } > return flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()). > addInitializationsFrom(assertWhenTrueInfo.discardInitializationInfo()); >Index: compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java,v >retrieving revision 1.69 >diff -u -r1.69 UnconditionalFlowInfo.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 21 Sep 2010 06:32:55 -0000 1.69 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 29 Sep 2010 12:09:51 -0000 >@@ -1466,6 +1466,7 @@ > throw new AssertionFailedException("COVERAGE 28"); //$NON-NLS-1$ > } > } >+ combineNullStatusChangeInAssertInfo(otherInits); > return this; > } > if ((this.tagBits & UNREACHABLE) != 0) { >@@ -1474,6 +1475,7 @@ > throw new AssertionFailedException("COVERAGE 29"); //$NON-NLS-1$ > } > } >+ otherInits.combineNullStatusChangeInAssertInfo(this); > return (UnconditionalFlowInfo) otherInits.copy(); // make sure otherInits won't be affected > } > >@@ -1761,6 +1763,7 @@ > copy.potentialInits = this.potentialInits; > copy.tagBits = this.tagBits & ~NULL_FLAG_MASK; > copy.maxFieldCount = this.maxFieldCount; >+ copy.nullStatusChangedInAssert = this.nullStatusChangedInAssert; > if (this.extra != null) { > int length; > copy.extra = new long[extraLength][]; >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.232 >diff -u -r1.232 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 24 Sep 2010 06:30:56 -0000 1.232 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 29 Sep 2010 12:09:51 -0000 >@@ -131,7 +131,7 @@ > public static final String OPTION_ReportDeadCodeInTrivialIfStatement = "org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement"; //$NON-NLS-1$ > public static final String OPTION_ReportTasks = "org.eclipse.jdt.core.compiler.problem.tasks"; //$NON-NLS-1$ > public static final String OPTION_ReportUnusedObjectAllocation = "org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation"; //$NON-NLS-1$ >- public static final String OPTION_SuppressNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.suppressNullInfoFromAsserts"; //$NON-NLS-1$ >+ public static final String OPTION_IncludeNullInfoFromAsserts = "org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$ > // Backward compatibility > public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ > public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$ >@@ -352,8 +352,8 @@ > public boolean generateClassFiles; > /** Indicate if method bodies should be ignored */ > public boolean ignoreMethodBodies; >- /** Suppress null related warnings for variables tainted inside an assert statement (java 1.5 and above)*/ >- public boolean suppressNullInfoFromAsserts; >+ /** Raise null related warnings for variables tainted inside an assert statement (java 1.5 and above)*/ >+ public boolean includeNullInfoFromAsserts; > > // keep in sync with warningTokenToIrritant and warningTokenFromIrritant > public final static String[] warningTokens = { >@@ -916,7 +916,7 @@ > optionsMap.put(OPTION_ReportDeadCodeInTrivialIfStatement, this.reportDeadCodeInTrivialIfStatement ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportTasks, getSeverityString(Tasks)); > optionsMap.put(OPTION_ReportUnusedObjectAllocation, getSeverityString(UnusedObjectAllocation)); >- optionsMap.put(OPTION_SuppressNullInfoFromAsserts, this.suppressNullInfoFromAsserts ? ENABLED : DISABLED); >+ optionsMap.put(OPTION_IncludeNullInfoFromAsserts, this.includeNullInfoFromAsserts ? ENABLED : DISABLED); > return optionsMap; > } > >@@ -1063,7 +1063,7 @@ > this.ignoreMethodBodies = false; > > // allow null info from asserts to be considered downstream by default >- this.suppressNullInfoFromAsserts = false; >+ this.includeNullInfoFromAsserts = false; > } > > public void set(Map optionsMap) { >@@ -1270,11 +1270,11 @@ > this.reportMissingOverrideAnnotationForInterfaceMethodImplementation = false; > } > } >- if ((optionValue = optionsMap.get(OPTION_SuppressNullInfoFromAsserts)) != null) { >+ if ((optionValue = optionsMap.get(OPTION_IncludeNullInfoFromAsserts)) != null) { > if (ENABLED.equals(optionValue)) { >- this.suppressNullInfoFromAsserts = true; >+ this.includeNullInfoFromAsserts = true; > } else if (DISABLED.equals(optionValue)) { >- this.suppressNullInfoFromAsserts = false; >+ this.includeNullInfoFromAsserts = false; > } > } > if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue); >@@ -1519,7 +1519,7 @@ > buf.append("\n\t- missing @Override annotation for interface method implementation: ").append(this.reportMissingOverrideAnnotationForInterfaceMethodImplementation ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- missing @Deprecated annotation: ").append(getSeverityString(MissingDeprecatedAnnotation)); //$NON-NLS-1$ > buf.append("\n\t- incomplete enum switch: ").append(getSeverityString(IncompleteEnumSwitch)); //$NON-NLS-1$ >- buf.append("\n\t- suppress null related warnings for variables tainted in assert statements: ").append(this.suppressNullInfoFromAsserts ? ENABLED : DISABLED); //$NON-NLS-1$ >+ buf.append("\n\t- raise null related warnings for variables tainted in assert statements: ").append(this.includeNullInfoFromAsserts ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- suppress warnings: ").append(this.suppressWarnings ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- suppress optional errors: ").append(this.suppressOptionalErrors ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- unhandled warning token: ").append(getSeverityString(UnhandledWarningToken)); //$NON-NLS-1$ >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.653 >diff -u -r1.653 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 24 Sep 2010 06:30:56 -0000 1.653 >+++ model/org/eclipse/jdt/core/JavaCore.java 29 Sep 2010 12:09:51 -0000 >@@ -1427,20 +1427,20 @@ > */ > public static final String COMPILER_PB_SUPPRESS_WARNINGS = PLUGIN_ID + ".compiler.problem.suppressWarnings"; //$NON-NLS-1$ > /** >- * Compiler option ID: Suppress null related warnings arising because of assert statements. >- * <p>When enabled, the compiler will not flag null warnings on variables that got marked as maybe or definitely >- * <code>null</code> in an assert statement upstream.</p> >- * <p>When disabled, the compiler will flag all null related warnings that have been enabled by the user, >+ * Compiler option ID: Raise null related errors or warnings arising because of assert statements. >+ * <p>When enabled, the compiler will flag all null related errors or warnings that have been enabled by the user, > * irrespective of whether a variable occurred in an assert statement.</p> >+ * <p>When disabled, the compiler will not flag null related errors or warnings on variables that got marked as maybe or definitely >+ * <code>null</code> in an assert statement upstream.</p> > * <dl> >- * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.suppressNullInfoFromAsserts"</code></dd> >+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts"</code></dd> > * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd> > * <dt>Default:</dt><dd><code>"disabled"</code></dd> > * </dl> > * @since 3.7 > * @category CompilerOptionID > */ >- public static final String COMPILER_PB_SUPPRESS_NULL_INFO_ASSERTS = PLUGIN_ID + ".compiler.problem.suppressNullInfoFromAsserts"; //$NON-NLS-1$ >+ public static final String COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS = PLUGIN_ID + ".compiler.problem.includeNullInfoFromAsserts"; //$NON-NLS-1$ > /** > * Compiler option ID: Further Determining the Effect of <code>@SuppressWarnings</code> if also > * {@link #COMPILER_PB_SUPPRESS_WARNINGS} is enabled. >@@ -1488,7 +1488,9 @@ > * Compiler option ID: Reporting Null Dereference. > * <p>When enabled, the compiler will issue an error or a warning whenever a > * variable that is statically known to hold a null value is used to >- * access a field or method. >+ * access a field or method.</p> >+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS} >+ * is enabled.</p> > * <dl> > * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.nullReference"</code></dd> > * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd> >@@ -1503,7 +1505,9 @@ > * <p>When enabled, the compiler will issue an error or a warning whenever a > * variable that has formerly been tested against null but is not (no more) > * statically known to hold a non-null value is used to access a field or >- * method. >+ * method.</p> >+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS} >+ * is enabled.</p> > * <dl> > * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.potentialNullReference"</code></dd> > * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd> >@@ -1517,7 +1521,9 @@ > * Compiler option ID: Reporting Redundant Null Check. > * <p>When enabled, the compiler will issue an error or a warning whenever a > * variable that is statically known to hold a null or a non-null value >- * is tested against null. >+ * is tested against null.</p> >+ * <p>Assert statements are ignored unless {@link #COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS} >+ * is enabled.</p> > * <dl> > * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.redundantNullCheck"</code></dd> > * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd> >#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.211 >diff -u -r1.211 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 24 Sep 2010 06:30:50 -0000 1.211 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 29 Sep 2010 12:09:57 -0000 >@@ -1652,86 +1652,65 @@ > "{0} {1}\n" + > "{2}\n" + > " \n" + >- " Warning options:\n" + >- " -deprecation + deprecation outside deprecated code\n" + >- " -nowarn -warn:none disable all warnings\n" + >- " -warn:<warnings separated by ,> enable exactly the listed warnings\n" + >- " -warn:+<warnings separated by ,> enable additional warnings\n" + >- " -warn:-<warnings separated by ,> disable specific warnings\n" + >- " allDeadCode dead code including trivial if(DEBUG) check\n" + >- " allDeprecation deprecation including inside deprecated code\n" + >- " allJavadoc invalid or missing javadoc\n" + >- " allOver-ann all missing @Override annotations\n" + >- " assertIdentifier + ''assert'' used as identifier\n" + >- " boxing autoboxing conversion\n" + >- " charConcat + char[] in String concat\n" + >- " compareIdentical + comparing identical expressions\n" + >- " conditionAssign possible accidental boolean assignment\n" + >- " constructorName + method with constructor name\n" + >- " deadCode + dead code excluding trivial if (DEBUG) check\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" + >+ " Warning options:\n" + >+ " -deprecation + deprecation outside deprecated code\n" + >+ " -nowarn -warn:none disable all warnings\n" + >+ " -warn:<warnings separated by ,> enable exactly the listed warnings\n" + >+ " -warn:+<warnings separated by ,> enable additional warnings\n" + >+ " -warn:-<warnings separated by ,> disable specific warnings\n" + >+ " allDeadCode dead code including trivial if(DEBUG) check\n" + >+ " allDeprecation deprecation including inside deprecated code\n" + >+ " allJavadoc invalid or missing javadoc\n" + >+ " allOver-ann all missing @Override annotations\n" + >+ " assertIdentifier + ''assert'' used as identifier\n" + >+ " boxing autoboxing conversion\n" + >+ " charConcat + char[] in String concat\n" + >+ " compareIdentical + comparing identical expressions\n" + >+ " conditionAssign possible accidental boolean assignment\n" + >+ " constructorName + method with constructor name\n" + >+ " deadCode + dead code excluding trivial if (DEBUG) check\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" + > " enumIdentifier ''enum'' used as identifier\n" + >- " enumSwitch incomplete enum switch\n" + >- " fallthrough possible fall-through case\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" + >+ " enumSwitch incomplete enum switch\n" + >+ " fallthrough possible fall-through case\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" + > " hashCode missing hashCode() method when overriding equals()\n" + >- " hiding macro for fieldHiding, localHiding, typeHiding and\n" + >- " maskedCatchBlock\n" + >- " incomplete-switch same as enumSwitch\n" + >- " indirectStatic indirect reference to static member\n" + >- " intfAnnotation + annotation type used as super interface\n" + >- " intfNonInherited + interface non-inherited method compatibility\n" + >+ " hiding macro for fieldHiding, localHiding, typeHiding and\n" + >+ " maskedCatchBlock\n" + >+ " includeAssertNull raise null warnings for variables\n" + >+ " that got tainted in an assert expression\n" + >+ " incomplete-switch same as enumSwitch\n" + >+ " indirectStatic indirect reference to static member\n" + >+ " intfAnnotation + annotation type used as super interface\n" + >+ " intfNonInherited + interface non-inherited method compatibility\n" + > " intfRedundant find redundant superinterfaces\n" + >- " javadoc invalid javadoc\n" + >- " localHiding local variable hiding another variable\n" + >- " maskedCatchBlock + hidden catch block\n" + >- " nls string literal lacking non-nls tag //$NON-NLS-<n>$\n" + >- " noEffectAssign + assignment without effect\n" + >- " null potential missing or redundant null check\n" + >- " nullDereference + missing null check\n" + >- " over-ann missing @Override annotation (superclass)\n" + >- " paramAssign assignment to a parameter\n" + >- " pkgDefaultMethod + attempt to override package-default method\n" + >- " raw + usage of raw type\n" + >- " semicolon unnecessary semicolon, empty statement\n" + >- " serial + missing serialVersionUID\n" + >- " specialParamHiding constructor or setter parameter hiding a field\n" + >- " static-access macro for indirectStatic and staticReceiver\n" + >- " staticReceiver + non-static reference to static member\n" + >- " super overriding a method without making a super invocation\n" + >+ " javadoc invalid javadoc\n" + >+ " localHiding local variable hiding another variable\n" + >+ " maskedCatchBlock + hidden catch block\n" + >+ " nls string literal lacking non-nls tag //$NON-NLS-<n>$\n" + >+ " noEffectAssign + assignment without effect\n" + >+ " null potential missing or redundant null check\n" + >+ " nullDereference + missing null check\n" + >+ " over-ann missing @Override annotation (superclass)\n" + >+ " paramAssign assignment to a parameter\n" + >+ " pkgDefaultMethod + attempt to override package-default method\n" + >+ " raw + usage of raw type\n" + >+ " semicolon unnecessary semicolon, empty statement\n" + >+ " serial + missing serialVersionUID\n" + >+ " specialParamHiding constructor or setter parameter hiding a field\n" + >+ " static-access macro for indirectStatic and staticReceiver\n" + >+ " staticReceiver + non-static reference to static member\n" + >+ " super overriding a method without making a super invocation\n" + > " suppress + enable @SuppressWarnings\n" + >- " When used with -err:, it can also silent optional\n" + >- " errors and warnings\n" + >- " suppressAssertNull suppress null warnings for variables\n" + >- " that got tainted in an assert expression\n" + >- " syncOverride missing synchronized in synchr. method override\n" + >- " syntheticAccess synthetic access for innerclass\n" + >- " tasks(<tags separated by |>) tasks identified by tags inside comments\n" + >- " typeHiding + type parameter hiding another type\n" + >- " unchecked + unchecked type operation\n" + >- " unnecessaryElse unnecessary else clause\n" + >- " unqualifiedField unqualified reference to field\n" + >- " unused macro for unusedAllocation, unusedArgument,\n" + >- " unusedImport, unusedLabel, unusedLocal,\n" + >- " unusedPrivate, unusedThrown, and unusedTypeArgs\n" + >- " unusedAllocation allocating an object that is not used\n" + >- " unusedArgument unread method parameter\n" + >- " unusedImport + unused import declaration\n" + >- " unusedLabel + unused label\n" + >- " unusedLocal + unread local variable\n" + >- " unusedPrivate + unused private member declaration\n" + >- " unusedThrown unused declared thrown exception\n" + >- " unusedTypeArgs + unused type arguments for method\n" + >- " uselessTypeCheck unnecessary cast/instanceof operation\n" + >- " varargsCast + varargs argument need explicit cast\n" + >- " warningToken + unsupported or unnecessary @SuppressWarnings\n" + >- "\n"; >+ " When used with -err:, it can also silent optional\n" + >+ " errors and warnings\n" + >+ "\n"; > String expandedExpectedOutput = > MessageFormat.format(expectedOutput, new String[] { > MAIN.bind("compiler.name"), >@@ -1819,6 +1798,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.forbiddenReference\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch\" value=\"ignore\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.indirectStaticAccess\" value=\"ignore\"/>\n" + >@@ -1856,7 +1836,6 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + >- " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressNullInfoFromAsserts\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" + >@@ -11129,7 +11108,9 @@ > } > > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342 >-// -warn option - regression tests to check option suppressAssertNull >+// -warn option - regression tests to check option includeAssertNull >+// No null problems arising from asserts should be reported here >+// since includeAssertNull is not enabled > public void test293_warn_options() { > this.runConformTest( > new String[] { >@@ -11165,15 +11146,30 @@ > }, > "\"" + OUTPUT_DIR + File.separator + "X.java\"" > + " -sourcepath \"" + OUTPUT_DIR + "\"" >- + " -warn:null,suppressAssertNull -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"", >+ + " -warn:null,includeAssertNull -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"", > "", >- "----------\n" + >- "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 10)\n" + >+ "----------\n" + >+ "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + >+ " if (a!=null) {\n" + >+ " ^\n" + >+ "Null comparison always yields false: The variable a can only be null at this location\n" + >+ "----------\n" + >+ "2. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 10)\n" + > " if (a== null) {}\n" + > " ^\n" + > "Redundant null check: The variable a can only be null at this location\n" + > "----------\n" + >- "1 problem (1 warning)", >+ "3. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 12)\n" + >+ " if (b!=null) {\n" + >+ " ^\n" + >+ "Redundant null check: The variable b cannot be null at this location\n" + >+ "----------\n" + >+ "4. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 18)\n" + >+ " if (c.equals(a)) {\n" + >+ " ^\n" + >+ "Null pointer access: The variable c can only be null at this location\n" + >+ "----------\n" + >+ "4 problems (4 warnings)", > true); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784 >Index: src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java,v >retrieving revision 1.105 >diff -u -r1.105 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 24 Sep 2010 06:30:50 -0000 1.105 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 29 Sep 2010 12:09:57 -0000 >@@ -57,6 +57,7 @@ > defaultOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR); > defaultOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR); > defaultOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); >+ defaultOptions.put(CompilerOptions.OPTION_IncludeNullInfoFromAsserts, CompilerOptions.ENABLED); > } > return defaultOptions; > } >@@ -13496,11 +13497,11 @@ > > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342 > // Null warnings because of assert statements should be suppressed >-// when CompilerOptions.OPTION_SuppressNullInfoFromAsserts is enabled. >+// when CompilerOptions.OPTION_IncludeNullInfoFromAsserts is disabled. > public void testBug325342a() { > if (this.complianceLevel >= ClassFileConstants.JDK1_5) { > Map compilerOptions = getCompilerOptions(); >- compilerOptions.put(CompilerOptions.OPTION_SuppressNullInfoFromAsserts, CompilerOptions.ENABLED); >+ compilerOptions.put(CompilerOptions.OPTION_IncludeNullInfoFromAsserts, CompilerOptions.DISABLED); > this.runNegativeTest( > new String[] { > "Test.java", >@@ -13546,11 +13547,11 @@ > > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=325342 > // Null warnings because of assert statements should not be suppressed >-// when CompilerOptions.OPTION_SuppressNullInfoFromAsserts is disabled. >+// when CompilerOptions.OPTION_IncludeNullInfoFromAsserts is enabled. > public void testBug325342b() { > if (this.complianceLevel >= ClassFileConstants.JDK1_5) { > Map compilerOptions = getCompilerOptions(); >- compilerOptions.put(CompilerOptions.OPTION_SuppressNullInfoFromAsserts, CompilerOptions.DISABLED); >+ compilerOptions.put(CompilerOptions.OPTION_IncludeNullInfoFromAsserts, CompilerOptions.ENABLED); > this.runNegativeTest( > new String[] { > "Test.java", >#P org.eclipse.jdt.doc.isv >Index: guide/jdt_api_options.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.isv/guide/jdt_api_options.htm,v >retrieving revision 1.75 >diff -u -r1.75 jdt_api_options.htm >--- guide/jdt_api_options.htm 2 Jun 2010 13:02:29 -0000 1.75 >+++ guide/jdt_api_options.htm 29 Sep 2010 12:10:00 -0000 >@@ -503,6 +503,26 @@ > </tr> > > <tr> >+<td colspan=2><a name = "INCLUDE_ASSERTS_IN_NULL_ANALYSIS"></a><b>Reporting Null related problems as a consequnce of assert statements</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS">COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS</a></b>)</td> >+</tr> >+<tr valign="top"> >+<td rowspan=2>When enabled, the compiler will raise null related errors or warnings for >+ a variable that got marked as potentially or definitely <code>null</code> or >+ not <code>null</code> inside an assert statement, and whose null state has not >+ been modified by any other statement following the assert. >+ <br>This option has an effect only when the compiler compliance is 1.5 or greater. >+ <br>Note that this option is only relevant in the context of the warnings raised >+ by the options <a href="#REDUNDANT_NULL_CHECK">COMPILER_PB_REDUNDANT_NULL_CHECK</a>, >+ <a href="#NULL_REFERENCE">COMPILER_PB_NULL_REFERENCE</a>, and >+ <a href="#POTENTIAL_NULL_REFERENCE">COMPILER_PB_POTENTIAL_NULL_REFERENCE</a> as a consequence of >+ an assert statement.</td> >+<td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ENABLED">ENABLED</a></b></td> >+</tr> >+<tr valign="top"> >+<td><b><i><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#DISABLED">DISABLED</a></i></b></td> >+</tr> >+ >+<tr> > <td colspan=2><b>Reporting Interface Method not Compatible with non-Inherited Methods</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD">COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD</a></b>)</td> > </tr> > <tr valign="top"> >@@ -861,12 +881,15 @@ > </tr> > > <tr> >-<td colspan=2><b>Reporting Null Dereference</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_NULL_REFERENCE">COMPILER_PB_NULL_REFERENCE</a></b>)</td> >+<td colspan=2><a name = "NULL_REFERENCE"></a><b>Reporting Null Dereference</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_NULL_REFERENCE">COMPILER_PB_NULL_REFERENCE</a></b>)</td> > </tr> > <tr valign="top"> > <td rowspan=3>When enabled, the compiler will issue an error or a warning > whenever a variable that is statically known to hold a null value is used to >- access a field or method.</td> >+ access a field or method. >+ <br>Errors or warnings raised due to this option arising as a consequence of asserts can be >+ controlled by <a href = "#INCLUDE_ASSERTS_IN_NULL_ANALYSIS">COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS</a> >+ (java 1.5 and greater)</td> > <td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ERROR">ERROR</a></b></td> > </tr> > <tr valign="top"> >@@ -892,13 +915,16 @@ > </tr> > > <tr> >-<td colspan=2><b>Reporting Potential Null Dereference</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_POTENTIAL_NULL_REFERENCE">COMPILER_PB_POTENTIAL_NULL_REFERENCE</a></b>)</td> >+<td colspan=2><a name = "POTENTIAL_NULL_REFERENCE"></a><b>Reporting Potential Null Dereference</b> (<b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_POTENTIAL_NULL_REFERENCE">COMPILER_PB_POTENTIAL_NULL_REFERENCE</a></b>)</td> > </tr> > <tr valign="top"> > <td rowspan=3>When enabled, the compiler will issue an error or a warning > whenever a variable that has formerly been tested against null but is not (no > more) statically known to hold a non-null value is used to access a field or >- method.</td> >+ method. >+ <br>Errors or warnings raised due to this option arising as a consequence of asserts can be >+ controlled by <a href = "#INCLUDE_ASSERTS_IN_NULL_ANALYSIS">COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS</a> >+ (java 1.5 and greater)</td> > <td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ERROR">ERROR</a></b></td> > </tr> > <tr valign="top"> >@@ -909,13 +935,16 @@ > </tr> > > <tr> >-<td colspan=2><b>Reporting Redundant Null Check</b> (<b><a href= >+<td colspan=2><a name = "REDUNDANT_NULL_CHECK"></a><b>Reporting Redundant Null Check</b> (<b><a href= > "../reference/api/org/eclipse/jdt/core/JavaCore.html#COMPILER_PB_REDUNDANT_NULL_CHECK">COMPILER_PB_REDUNDANT_NULL_CHECK</a></b>)</td> > </tr> > <tr valign="top"> > <td rowspan=3>When enabled, the compiler will issue an error or a warning > whenever a variable that is statically known to hold a null or a non-null >- value is tested against null.</td> >+ value is tested against null. >+ <br>Errors or warnings raised due to this option arising as a consequence of asserts can be >+ controlled by <a href = "#INCLUDE_ASSERTS_IN_NULL_ANALYSIS">COMPILER_PB_INCLUDE_ASSERTS_IN_NULL_ANALYSIS</a> >+ (java 1.5 and greater)</td> > <td><b><a href="../reference/api/org/eclipse/jdt/core/JavaCore.html#ERROR">ERROR</a></b></td> > </tr> > <tr valign="top">
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 325342
:
179233
|
179470
|
179730
| 179836