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 207843 Details for
Bug 365387
[compiler][null] bug 186342: Issues to follow up post review and verification.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test & fix for a wrong warning
wrong-warning-redundantnullcheck.patch (text/plain), 3.05 KB, created by
Stephan Herrmann
on 2011-12-02 09:05:23 EST
(
hide
)
Description:
test & fix for a wrong warning
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-12-02 09:05:23 EST
Size:
3.05 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >index 907ac4e..adff41e 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java >@@ -52,7 +52,7 @@ > // Static initializer to specify tests subset using TESTS_* static variables > // All specified tests which do not belong to the class are skipped... > static { >-// TESTS_NAMES = new String[] { "test_illegal_annotation_007" }; >+// TESTS_NAMES = new String[] { "test_assignment_expression_1" }; > // TESTS_NUMBERS = new int[] { 561 }; > // TESTS_RANGE = new int[] { 1, 2049 }; > } >@@ -2474,6 +2474,36 @@ > "Type mismatch: required \'@NonNull String\' but the provided value can be null\n" + > "----------\n"); > } >+public void test_assignment_expression_1() { >+ Map customOptions = getCompilerOptions(); >+// customOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, JavaCore.ERROR); >+ customOptions.put(JavaCore.COMPILER_NONNULL_IS_DEFAULT, JavaCore.ENABLED); >+ customOptions.put(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK, JavaCore.ERROR); >+ runConformTestWithLibs( >+ new String[] { >+ "X.java", >+ "import org.eclipse.jdt.annotation.*;\n" + >+ "public class X {\n" + >+ " @Nullable Object foo() {\n" + >+ " Object o = null;\n" + >+ " boolean keepLooking = true;\n" + >+ " while(keepLooking) {\n" + >+ " if ((o=getO()) != null) {\n" + >+ " return o;\n" + >+ " }\n" + >+ " }\n" + >+ " return null;\n" + >+ " }\n" + >+ "\n" + >+ " private @Nullable Object getO() {\n" + >+ " return new Object();\n" + >+ " }\n" + >+ "}\n", >+ >+ }, >+ customOptions, >+ ""); >+} > // a nonnull variable is dereferenced method of a nested type > public void test_nesting_1() { > Map customOptions = getCompilerOptions(); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >index 1d8c153..3eda768 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java >@@ -119,7 +119,7 @@ > } > public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { > super.checkNPE(scope, flowContext, flowInfo); >- if (nullStatus(flowInfo) == FlowInfo.POTENTIALLY_NULL) >+ if ((nullStatus(flowInfo) & FlowInfo.POTENTIALLY_NULL) != 0) > scope.problemReporter().messageSendPotentialNullReference(this.binding, this); > } > /** >@@ -281,7 +281,7 @@ > if ((tagBits & TagBits.AnnotationNonNull) != 0) > return FlowInfo.NON_NULL; > if ((tagBits & TagBits.AnnotationNullable) != 0) >- return FlowInfo.POTENTIALLY_NULL; >+ return FlowInfo.POTENTIALLY_NULL | FlowInfo.POTENTIALLY_NON_NULL; > } > return FlowInfo.UNKNOWN; > }
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 365387
:
207842
|
207843
|
207876
|
207888
|
207952