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 150812 Details for
Bug 285002
[compiler] visibility error for package private method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Potential patch
patch.txt (text/plain), 6.89 KB, created by
Srikanth Sankaran
on 2009-10-29 07:10:42 EDT
(
hide
)
Description:
Potential patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2009-10-29 07:10:42 EDT
Size:
6.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java,v >retrieving revision 1.54 >diff -u -r1.54 CodeSnippetScope.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java 5 Dec 2008 12:41:29 -0000 1.54 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java 29 Oct 2009 11:04:56 -0000 >@@ -121,7 +121,7 @@ > // receiverType can be an array binding in one case... see if you can change it > if (receiverType instanceof ArrayBinding) > return false; >- ReferenceBinding type = (ReferenceBinding) receiverType; >+ ReferenceBinding type = (ReferenceBinding) (receiverType.isCapture() ? receiverType.erasure() : receiverType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 > PackageBinding declaringPackage = fieldBinding.declaringClass.fPackage; > TypeBinding originalDeclaringClass = fieldBinding.declaringClass .original(); > do { >@@ -192,7 +192,7 @@ > // receiverType can be an array binding in one case... see if you can change it > if (receiverType instanceof ArrayBinding) > return false; >- ReferenceBinding type = (ReferenceBinding) receiverType; >+ ReferenceBinding type = (ReferenceBinding) (receiverType.isCapture() ? receiverType.erasure() : receiverType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 > PackageBinding declaringPackage = methodBinding.declaringClass.fPackage; > TypeBinding originalDeclaringClass = methodBinding.declaringClass .original(); > do { >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.136 >diff -u -r1.136 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 27 Aug 2009 14:19:16 -0000 1.136 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 29 Oct 2009 11:04:56 -0000 >@@ -258,7 +258,7 @@ > // isDefault() > if (invocationType.fPackage != this.fPackage) return false; > >- ReferenceBinding currentType = receiverType; >+ ReferenceBinding currentType = (ReferenceBinding) (receiverType.isCapture() ? receiverType.erasure() : receiverType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 > TypeBinding originalDeclaringClass = (enclosingType() == null ? this : enclosingType()).original(); > do { > if (originalDeclaringClass == currentType.original()) return true; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java,v >retrieving revision 1.122 >diff -u -r1.122 MethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 8 Oct 2009 19:37:33 -0000 1.122 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java 29 Oct 2009 11:04:52 -0000 >@@ -321,7 +321,7 @@ > if (receiverType instanceof ArrayBinding) > return false; > TypeBinding originalDeclaringClass = this.declaringClass.original(); >- ReferenceBinding currentType = (ReferenceBinding) receiverType; >+ ReferenceBinding currentType = (ReferenceBinding) (receiverType.isCapture() ? receiverType.erasure() : receiverType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 > do { > if (originalDeclaringClass == currentType.original()) return true; > PackageBinding currentPackage = currentType.fPackage; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java,v >retrieving revision 1.57 >diff -u -r1.57 FieldBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 7 Mar 2009 00:59:02 -0000 1.57 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 29 Oct 2009 11:04:50 -0000 >@@ -139,7 +139,7 @@ > if (receiverType instanceof ArrayBinding) > return false; > TypeBinding originalDeclaringClass = this.declaringClass.original(); >- ReferenceBinding currentType = (ReferenceBinding) receiverType; >+ ReferenceBinding currentType = (ReferenceBinding) (receiverType.isCapture() ? receiverType.erasure() : receiverType); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 > do { > if (originalDeclaringClass == currentType.original()) return true; > PackageBinding currentPackage = currentType.fPackage; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v >retrieving revision 1.807 >diff -u -r1.807 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 15 Oct 2009 18:57:45 -0000 1.807 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 29 Oct 2009 11:06:49 -0000 >@@ -49884,4 +49884,36 @@ > "" > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002 (visibility error for package private method) >+public void test1457() { >+ this.runConformTest( >+ new String[] { >+ "CompilerBug.java", >+ "public class CompilerBug {\n" + >+ " public <T> T newInstance( Class<T> c ) throws InstantiationException, IllegalAccessException {\n" + >+ " return c.newInstance();\n" + >+ " }\n" + >+ " protected void protectedMethod() {}\n" + >+ " void packagePrivateMethod() {}\n" + >+ " private void privateMethod() {}\n" + >+ " private int privateInt = 0;\n" + >+ " int packagePrivateInt = 0;\n" + >+ " protected int protectedInt = 0;\n" + >+ " private void isThisBuggy() throws InstantiationException, IllegalAccessException {\n" + >+ " CompilerBug c = getClass().newInstance();\n" + >+ " c.privateMethod();\n" + >+ " c.packagePrivateMethod();\n" + >+ " c.protectedMethod();\n" + >+ " getClass().newInstance().packagePrivateMethod();\n" + >+ " getClass().newInstance().privateMethod();\n" + >+ " getClass().newInstance().protectedMethod();\n" + >+ " getClass().newInstance().privateInt = 10;\n" + >+ " getClass().newInstance().packagePrivateInt = 10;\n" + >+ " getClass().newInstance().protectedInt = 10;\n" + >+ " }\n" + >+ " }\n" >+ }, >+ null, >+ null); // no specific success output string >+} > } >\ 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 285002
:
142884
| 150812