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 173837 Details for
Bug 314556
[1.5][compiler] compiler fails to report attempt to assign weaker access privileges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Cleaner patch
patch.txt (text/plain), 5.16 KB, created by
Srikanth Sankaran
on 2010-07-09 01:01:52 EDT
(
hide
)
Description:
Cleaner patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-07-09 01:01:52 EDT
Size:
5.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java,v >retrieving revision 1.112 >diff -u -r1.112 MethodVerifier15.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 23 Jun 2010 08:25:53 -0000 1.112 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 9 Jul 2010 03:21:58 -0000 >@@ -541,6 +541,21 @@ > int count = index + 1; > while (--count > 0) { > MethodBinding match = matchingInherited[count]; >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556 >+ MethodBinding interfaceMethod = null, implementation = null; >+ if (first.declaringClass.isInterface()) { >+ interfaceMethod = first; >+ } else if (first.declaringClass.isClass()) { >+ implementation = first; >+ } >+ if (match.declaringClass.isInterface()) { >+ interfaceMethod = match; >+ } else if (match.declaringClass.isClass()) { >+ implementation = match; >+ } >+ if (interfaceMethod != null && implementation != null && !isAsVisible(implementation, interfaceMethod)) >+ problemReporter().inheritedMethodReducesVisibility(typeParameter, implementation, new MethodBinding [] {interfaceMethod}); >+ > if (areReturnTypesCompatible(first, match)) continue; > // unrelated interfaces - check to see if return types are compatible > if (first.declaringClass.isInterface() && match.declaringClass.isInterface() && areReturnTypesCompatible(match, first)) >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.412 >diff -u -r1.412 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 7 Jul 2010 05:56:10 -0000 1.412 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 9 Jul 2010 03:22:01 -0000 >@@ -2747,7 +2747,7 @@ > location.sourceStart, > location.sourceEnd); > } >-public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { >+private void inheritedMethodReducesVisibility(int sourceStart, int sourceEnd, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { > StringBuffer concreteSignature = new StringBuffer(); > concreteSignature > .append(concreteMethod.declaringClass.readableName()) >@@ -2767,8 +2767,14 @@ > new String[] { > shortSignature.toString(), > new String(abstractMethods[0].declaringClass.shortReadableName())}, >- type.sourceStart(), >- type.sourceEnd()); >+ sourceStart, >+ sourceEnd); >+} >+public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { >+ inheritedMethodReducesVisibility(type.sourceStart(), type.sourceEnd(), concreteMethod, abstractMethods); >+} >+public void inheritedMethodReducesVisibility(TypeParameter typeParameter, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { >+ inheritedMethodReducesVisibility(typeParameter.sourceStart(), typeParameter.sourceEnd(), concreteMethod, abstractMethods); > } > public void inheritedMethodsHaveIncompatibleReturnTypes(ASTNode location, MethodBinding[] inheritedMethods, int length) { > StringBuffer methodSignatures = new StringBuffer(); >#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.821 >diff -u -r1.821 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 24 Jun 2010 07:30:00 -0000 1.821 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 9 Jul 2010 03:22:29 -0000 >@@ -50513,4 +50513,22 @@ > "Type mismatch: cannot convert from AnotherClass<capture#1-of ? extends IReferencedInterface> to AnotherClass<IReferencedInterface>\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556 >+public void test1463() { >+ this.runNegativeTest( >+ new String[] { >+ "BaseType.java", >+ "public interface BaseType {\n" + >+ " BaseType clone() throws CloneNotSupportedException;\n" + >+ "}\n" + >+ "interface SubType<T extends BaseType & java.io.Closeable> extends BaseType {\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in BaseType.java (at line 4)\n" + >+ " interface SubType<T extends BaseType & java.io.Closeable> extends BaseType {\n" + >+ " ^\n" + >+ "The inherited method Object.clone() cannot hide the public abstract method in BaseType\n" + >+ "----------\n"); >+} > } >\ 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 314556
:
173634
|
173659
| 173837