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 239656 Details for
Bug 427357
[1.8][dom ast] 'this' parameter unavailable in AST for static method declaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix + Test
Bug-427357.patch (text/plain), 4.02 KB, created by
Jay Arthanareeswaran
on 2014-02-05 07:02:48 EST
(
hide
)
Description:
Fix + Test
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2014-02-05 07:02:48 EST
Size:
4.02 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >index 9604dd3..45c21ea 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java >@@ -4023,3 +4023,48 @@ > assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, astNode.getNodeType()); > } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=427357 >+ public void testBug427357() throws JavaModelException { >+ String contents = >+ "public class X {\n" + >+ " public static void foo(X this, int i){}\n" + >+ " public void foo(Inner this){}\n" + >+ " I I = new I() {\n" + >+ " public void bar(I this, int i) {}\n" + >+ " };\n" + >+ " static class Inner {\n" + >+ " public Inner(Test2 Test2.this){}\n" + >+ " public Inner(Inner Inner.this, int i){}\n" + >+ " }\n" + >+ "}\n"+ >+ "interface I {}"; >+ this.workingCopy = getWorkingCopy("/Converter18/src/X.java", true); >+ ASTNode node = buildAST(contents, this.workingCopy, false); >+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType()); >+ CompilationUnit unit = (CompilationUnit) node; >+ TypeDeclaration typeDecl = (TypeDeclaration) unit.types().get(0); >+ MethodDeclaration method = (MethodDeclaration) typeDecl.bodyDeclarations().get(0); >+ Type receiver = method.getReceiverType(); >+ assertNotNull("Receiver should not be null", receiver); >+ assertEquals("Incorrect receiver type", "X", receiver.toString()); >+ >+ method = (MethodDeclaration) typeDecl.bodyDeclarations().get(1); >+ receiver = method.getReceiverType(); >+ assertNotNull("Receiver should not be null", receiver); >+ >+ FieldDeclaration field = (FieldDeclaration) typeDecl.bodyDeclarations().get(2); >+ ClassInstanceCreation anonymousInst = (ClassInstanceCreation ) ((VariableDeclarationFragment) field.fragments().get(0)).getInitializer(); >+ AnonymousClassDeclaration anonymousDecl = anonymousInst.getAnonymousClassDeclaration(); >+ method = (MethodDeclaration) anonymousDecl.bodyDeclarations().get(0); >+ receiver = method.getReceiverType(); >+ assertNotNull("Receiver should not be null", receiver); >+ assertEquals("Incorrect receiver type", "I", receiver.toString()); >+ typeDecl = (TypeDeclaration) typeDecl.bodyDeclarations().get(3); >+ method = (MethodDeclaration) typeDecl.bodyDeclarations().get(0); >+ receiver = method.getReceiverType(); >+ assertNotNull("Receiver should not be null", receiver); >+ assertEquals("Incorrect receiver type", "Test2", receiver.toString()); >+ method = (MethodDeclaration) typeDecl.bodyDeclarations().get(1); >+ receiver = method.getReceiverType(); >+ assertNotNull("Receiver should not be null", receiver); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >index b157cae..25326f7 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >@@ -560,5 +560,4 @@ > if (this.isStatic() || declaringClass.isAnonymousType()) { > this.scope.problemReporter().disallowedThisParameter(this.receiver); >- this.receiver = null; > return; // No need to do further validation > } >@@ -570,5 +569,4 @@ > || (declaringClass.tagBits & (TagBits.IsLocalType | TagBits.IsMemberType)) == 0) { /* neither member nor local type */ > this.scope.problemReporter().disallowedThisParameter(this.receiver); >- this.receiver = null; > return; // No need to do further validation > } >@@ -589,5 +587,4 @@ > if (TypeBinding.notEquals(enclosingReceiver, resolvedReceiverType)) { > this.scope.problemReporter().illegalTypeForExplicitThis(this.receiver, enclosingReceiver); >- this.receiver = null; > } > }
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 427357
: 239656