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 181578 Details for
Bug 328281
visibility leaks not detected when analyzing unused field in private class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix & test
Bug_328519.patch (text/plain), 5.70 KB, created by
Stephan Herrmann
on 2010-10-23 09:25:11 EDT
(
hide
)
Description:
proposed fix & test
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2010-10-23 09:25:11 EDT
Size:
5.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.181 >diff -u -r1.181 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 20 Oct 2010 05:46:47 -0000 1.181 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 23 Oct 2010 00:32:54 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 328281 - visibility leaks not detected when analyzing unused field in private class > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >@@ -903,6 +904,8 @@ > } else { > // only want to reach here when no errors are reported > sourceType.superclass = superclass; >+ if (superclass.isPrivate() && !sourceType.isPrivate()) >+ superclass.tagBits |= TagBits.IsPrivateWithNonPrivateSub; > return true; > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v >retrieving revision 1.139 >diff -u -r1.139 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 3 Feb 2010 06:34:21 -0000 1.139 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 23 Oct 2010 00:32:56 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 328281 - visibility leaks not detected when analyzing unused field in private class > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >@@ -1108,7 +1109,7 @@ > if (isLocalType()) return true; // catch all local types > ReferenceBinding type = this; > while (type != null) { >- if ((type.modifiers & ClassFileConstants.AccPrivate) != 0) >+ if ((type.modifiers & ClassFileConstants.AccPrivate) != 0 && (type.tagBits & TagBits.IsPrivateWithNonPrivateSub) == 0) > return true; > type = type.enclosingType(); > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java,v >retrieving revision 1.44 >diff -u -r1.44 TagBits.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 21 Sep 2010 14:02:58 -0000 1.44 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 23 Oct 2010 00:32:56 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 328281 - visibility leaks not detected when analyzing unused field in private class > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >@@ -122,4 +123,7 @@ > > // set when type contains non-private constructor(s) > long HasNonPrivateConstructor = ASTNode.Bit53L; >+ >+ // set when a private class has a non-private subclass >+ long IsPrivateWithNonPrivateSub = ASTNode.Bit54L; > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java,v >retrieving revision 1.26 >diff -u -r1.26 ProgrammingProblemsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 22 Oct 2010 22:42:32 -0000 1.26 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 23 Oct 2010 00:33:03 -0000 >@@ -7,7 +7,9 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >- * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 185682 - Increment/decrement operators mark local variables as read >+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for >+ * bug 185682 - Increment/decrement operators mark local variables as read >+ * bug 328281 - visibility leaks not detected when analyzing unused field in private class > *******************************************************************************/ > package org.eclipse.jdt.core.tests.compiler.regression; > >@@ -2120,5 +2122,30 @@ > true/*shouldFlushOutputDirectory*/, > customOptions); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=328281 >+public void test0052() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "class X {\n" + >+ " Y y = new Y();\n" + >+ " private class Y {\n" + >+ " int abc;\n" + >+ " Y() {\n" + >+ " abc++;\n" + // not a relevant usage >+ " }\n" + >+ " }\n" + >+ " class Z extends Y {}\n" + // makes 'abc' externally accessible >+ "}" >+ }, >+ "", >+ null/*classLibraries*/, >+ true/*shouldFlushOutputDirectory*/, >+ null/*vmArguments*/, >+ customOptions, >+ null/*requestor*/); >+} > > } >\ No newline at end of file
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 328281
:
181578
|
181581
|
181611
|
193589