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 53390 Details for
Bug 163647
[model] Thrown exceptions are not found in method binding key which have a capture as declaring class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v00.txt (text/plain), 10.18 KB, created by
Frederic Fusier
on 2006-11-07 12:24:38 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-11-07 12:24:38 EST
Size:
10.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java,v >retrieving revision 1.67 >diff -u -r1.67 BatchASTCreationTests.java >--- src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 6 Nov 2006 14:20:14 -0000 1.67 >+++ src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 7 Nov 2006 17:03:50 -0000 >@@ -13,17 +13,29 @@ > import java.io.IOException; > import java.util.ArrayList; > >+import junit.framework.Test; >+ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.jdt.core.BindingKey; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IProblemRequestor; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.WorkingCopyOwner; >-import org.eclipse.jdt.core.dom.*; >+import org.eclipse.jdt.core.compiler.IProblem; >+import org.eclipse.jdt.core.dom.AST; >+import org.eclipse.jdt.core.dom.ASTNode; >+import org.eclipse.jdt.core.dom.ASTParser; >+import org.eclipse.jdt.core.dom.ASTRequestor; >+import org.eclipse.jdt.core.dom.CompilationUnit; >+import org.eclipse.jdt.core.dom.IBinding; >+import org.eclipse.jdt.core.dom.IMethodBinding; >+import org.eclipse.jdt.core.dom.ITypeBinding; >+import org.eclipse.jdt.core.dom.IVariableBinding; >+import org.eclipse.jdt.core.dom.Type; >+import org.eclipse.jdt.core.dom.TypeDeclaration; > import org.eclipse.jdt.core.tests.util.Util; > >-import junit.framework.Test; >- > public class BatchASTCreationTests extends AbstractASTTests { > > public class TestASTRequestor extends ASTRequestor { >@@ -200,6 +212,21 @@ > protected ICompilationUnit[] createWorkingCopies(String[] pathAndSources) throws JavaModelException { > return createWorkingCopies(pathAndSources, this.owner); > } >+ >+ protected ICompilationUnit[] createWorkingCopies(String[] pathAndSources, boolean resolve) throws JavaModelException { >+ IProblemRequestor problemRequestor = resolve >+ ? new IProblemRequestor() { >+ public void acceptProblem(IProblem problem) {} >+ public void beginReporting() {} >+ public void endReporting() {} >+ public boolean isActive() { >+ return true; >+ } >+ } >+ : null; >+ MarkerInfo[] markerInfos = createMarkerInfos(pathAndSources); >+ return createWorkingCopies(markerInfos, this.owner, problemRequestor); >+ } > > private void resolveASTs(ICompilationUnit[] cus, TestASTRequestor requestor) { > resolveASTs(cus, new String[0], requestor, getJavaProject("P"), this.owner); >@@ -1710,37 +1737,95 @@ > }, > "LX;.foo()V|Ljava/lang/InterruptedException;|Ljava/lang/IllegalMonitorStateException;" > ); >+ String content = "public class X {\n" + >+ " public void foo() throws InterruptedException, IllegalMonitorStateException {\n" + >+ " }\n" + >+ " void test() throws InterruptedException, IllegalMonitorStateException {\n" + >+ " /*start*/foo()/*end*/;\n" + >+ " }\n" + >+ "}"; >+ this.workingCopies = createWorkingCopies(new String[] { "/P/X.java", content }, true /*resolve*/); >+ ASTNode node = buildAST(content, this.workingCopies[0]); >+ assertEquals("Invalid node type!", ASTNode.METHOD_INVOCATION, node.getNodeType()); >+ IBinding binding = resolveBinding(node); >+ BindingKey bindingKey = new BindingKey(binding.getKey()); >+ assertStringsEqual("Unexpected thrown exceptions", >+ "Ljava.lang.InterruptedException;\n" + >+ "Ljava.lang.IllegalMonitorStateException;\n", >+ bindingKey.getThrownExceptions() >+ ); > } > public void test075_Bug155003() throws CoreException { >- assertBindingCreated( >- new String[] { >- "/P/X.java", >- "public class X<T> {\n" + >- " <U extends Exception> X<T> foo(X<T> x) throws RuntimeException, U {\n" + >- " return null;\n" + >- " }\n" + >- " void test() throws Exception {\n" + >- " /*start*/foo(this)/*end*/;\n" + >- " }\n" + >- "}" >- }, >- "LX<LX;:TT;>;.foo<U:Ljava/lang/Exception;>(LX<TT;>;)LX<TT;>;^Ljava/lang/RuntimeException;^TU;%<Ljava/lang/Exception;>" >+ String content = "public class X<T> {\n" + >+ " <U extends Exception> X<T> foo(X<T> x) throws RuntimeException, U {\n" + >+ " return null;\n" + >+ " }\n" + >+ " void test() throws Exception {\n" + >+ " /*start*/foo(this)/*end*/;\n" + >+ " }\n" + >+ "}"; >+ this.workingCopies = createWorkingCopies(new String[] { "/P/X.java", content }, true /*resolve*/); >+ ASTNode node = buildAST(content, this.workingCopies[0]); >+ assertEquals("Invalid node type!", ASTNode.METHOD_INVOCATION, node.getNodeType()); >+ IBinding binding = resolveBinding(node); >+ BindingKey bindingKey = new BindingKey(binding.getKey()); >+ assertStringsEqual("Unexpected thrown exceptions", >+ "Ljava.lang.RuntimeException;\n" + >+ "TU;\n", >+ bindingKey.getThrownExceptions() > ); > } > public void test076_Bug155003() throws CoreException { >- assertBindingCreated( >- new String[] { >- "/P/X.java", >- "public class X<T> {\n" + >- " <K, V> V bar(K key, V value) throws Exception {\n" + >- " return value;\n" + >- " }\n" + >- " void test() throws Exception {\n" + >- " /*start*/bar(\"\", \"\")/*end*/;\n" + >- " }\n" + >- "}" >- }, >- "LX<LX;:TT;>;.bar<K:Ljava/lang/Object;V:Ljava/lang/Object;>(TK;TV;)TV;|Ljava/lang/Exception;%<Ljava/lang/String;Ljava/lang/String;>" >+ String content = "public class X<T> {\n" + >+ " <K, V> V bar(K key, V value) throws Exception {\n" + >+ " return value;\n" + >+ " }\n" + >+ " void test() throws Exception {\n" + >+ " /*start*/bar(\"\", \"\")/*end*/;\n" + >+ " }\n" + >+ "}"; >+ this.workingCopies = createWorkingCopies(new String[] { "/P/X.java", content }, true /*resolve*/); >+ ASTNode node = buildAST(content, this.workingCopies[0]); >+ assertEquals("Invalid node type!", ASTNode.METHOD_INVOCATION, node.getNodeType()); >+ IBinding binding = resolveBinding(node); >+ BindingKey bindingKey = new BindingKey(binding.getKey()); >+ assertStringsEqual("Unexpected thrown exceptions", >+ "Ljava.lang.Exception;\n", >+ bindingKey.getThrownExceptions() >+ ); >+} >+ >+/** >+ * @bug 163647: [model] Thrown exceptions are not found in method binding key which have a capture as declaring class >+ * @test Ensure that thrown exceptions are added in method unique key (not in signature) >+ * even when declaring class is a capture >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=163647" >+ */ >+public void test077_Bug163647() throws CoreException { >+ String content = "public class Test {\n" + >+ " public X<? extends Object> getX() { return null; }\n" + >+ " public void bar() {\n" + >+ " try {\n" + >+ " /*start*/getX().foo()/*end*/;\n" + >+ " } catch (Exception e) {\n" + >+ " // skip\n" + >+ " }\n" + >+ " }\n" + >+ "}\n" + >+ "class X<T> {\n" + >+ " public void foo() throws CloneNotSupportedException, IllegalMonitorStateException, InterruptedException {\n" + >+ " }\n" + >+ "}"; >+ this.workingCopies = createWorkingCopies(new String[] { "/P/Test.java", content }, true /*resolve*/); >+ ASTNode node = buildAST(content, this.workingCopies[0]); >+ assertEquals("Invalid node type!", ASTNode.METHOD_INVOCATION, node.getNodeType()); >+ IBinding binding = resolveBinding(node); >+ BindingKey bindingKey = new BindingKey(binding.getKey()); >+ assertStringsEqual("Unexpected thrown exceptions", >+ "Ljava.lang.CloneNotSupportedException;\n" + >+ "Ljava.lang.IllegalMonitorStateException;\n" + >+ "Ljava.lang.InterruptedException;\n", >+ bindingKey.getThrownExceptions() > ); > } > } >Index: src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java,v >retrieving revision 1.28 >diff -u -r1.28 AbstractASTTests.java >--- src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java 13 Jul 2006 14:23:28 -0000 1.28 >+++ src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java 7 Nov 2006 17:03:50 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.jdt.core.IClassFile; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IProblemRequestor; > import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.WorkingCopyOwner; > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -379,11 +380,15 @@ > } > > protected ICompilationUnit[] createWorkingCopies(MarkerInfo[] markerInfos, WorkingCopyOwner owner) throws JavaModelException { >+ return createWorkingCopies(markerInfos, owner, null); >+ } >+ >+ protected ICompilationUnit[] createWorkingCopies(MarkerInfo[] markerInfos, WorkingCopyOwner owner, IProblemRequestor problemRequestor) throws JavaModelException { > int length = markerInfos.length; > ICompilationUnit[] copies = new ICompilationUnit[length]; > for (int i = 0; i < length; i++) { > MarkerInfo markerInfo = markerInfos[i]; >- ICompilationUnit workingCopy = getCompilationUnit(markerInfo.path).getWorkingCopy(owner, null, null); >+ ICompilationUnit workingCopy = getCompilationUnit(markerInfo.path).getWorkingCopy(owner, problemRequestor, null); > workingCopy.getBuffer().setContents(markerInfo.source); > workingCopy.makeConsistent(null); > copies[i] = workingCopy; >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/util/KeyToSignature.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/KeyToSignature.java,v >retrieving revision 1.24 >diff -u -r1.24 KeyToSignature.java >--- model/org/eclipse/jdt/internal/core/util/KeyToSignature.java 6 Nov 2006 14:19:55 -0000 1.24 >+++ model/org/eclipse/jdt/internal/core/util/KeyToSignature.java 7 Nov 2006 17:03:53 -0000 >@@ -275,6 +275,7 @@ > KeyToSignature keyToSignature = (KeyToSignature) this.arguments.get(0); > this.signature = keyToSignature.signature; > this.arguments = keyToSignature.arguments; >+ this.thrownExceptions = keyToSignature.thrownExceptions; > } > > public void consumeWildCard(int wildCardKind) {
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 163647
: 53390