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 161201 Details for
Bug 235658
Valid identifier unrecognized.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_235658.txt (text/plain), 4.65 KB, created by
Olivier Thomann
on 2010-03-05 17:24:46 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-03-05 17:24:46 EST
Size:
4.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.366 >diff -u -r1.366 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 9 Feb 2010 05:14:15 -0000 1.366 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 5 Mar 2010 22:23:48 -0000 >@@ -876,10 +876,26 @@ > ReferenceBinding memberType = enclosingType.getMemberType(typeName); > if (memberType != null) { > unitScope.recordTypeReference(memberType); >- if (enclosingReceiverType == null >- ? memberType.canBeSeenBy(getCurrentPackage()) >- : memberType.canBeSeenBy(enclosingType, enclosingReceiverType)) >+ if (enclosingReceiverType == null) { >+ if (memberType.canBeSeenBy(getCurrentPackage())) { > return memberType; >+ } >+ // maybe some type in the compilation unit is extending some class in some package >+ // and the selection is for some protected inner class of that superclass >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=235658 >+ if (this instanceof CompilationUnitScope) { >+ TypeDeclaration[] types = ((CompilationUnitScope)this).referenceContext.types; >+ if (types != null) { >+ for (int i = 0; i < types.length; i++) { >+ if (memberType.canBeSeenBy(enclosingType, types[i].binding)) { >+ return memberType; >+ } >+ } >+ } >+ } >+ } else if (memberType.canBeSeenBy(enclosingType, enclosingReceiverType)) { >+ return memberType; >+ } > return new ProblemReferenceBinding(new char[][]{typeName}, memberType, ProblemReasons.NotVisible); > } > return null; >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests.java,v >retrieving revision 1.90 >diff -u -r1.90 ResolveTests.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests.java 29 Oct 2008 15:56:34 -0000 1.90 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests.java 5 Mar 2010 22:23:49 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -12,10 +12,20 @@ > > import java.io.IOException; > >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.jdt.core.*; >+import junit.framework.Test; > >-import junit.framework.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.jdt.core.IClassFile; >+import org.eclipse.jdt.core.ICompilationUnit; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.ILocalVariable; >+import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.ISourceRange; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.core.WorkingCopyOwner; > > public class ResolveTests extends AbstractJavaModelTests { > ICompilationUnit wc = null; >@@ -2546,5 +2556,36 @@ > elements > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=235658 >+// To verify that "open declaration" works for a protected interface, which is >+// an inner type of an extending class's superclass. >+public void testInterfaceX() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Resolve/src/test/Bug.java", >+ "package test;\n"+ >+ "public class Bug {\n" + >+ " void foo() {}\n" + >+ " protected interface Proto {}\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Resolve/src/Type.java", >+ "import test.Bug;\n"+ >+ "import test.Bug.*;\n"+ >+ "class Type extends Bug implements Proto {\n" + >+ "}\n"); >+ >+ String str = this.workingCopies[1].getSource(); >+ int start = str.lastIndexOf("Proto"); >+ int length = "Proto".length(); >+ IJavaElement[] elements = this.workingCopies[1].codeSelect(start, length, this.wcOwner); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "Proto [in Bug [in [Working copy] Bug.java [in test [in src [in Resolve]]]]]", >+ elements >+ ); >+} > > }
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 235658
:
161089
|
161200
| 161201 |
161314