-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25286d9
commit 1416ee5
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/test/java/spoon/test/template/testclasses/TypeReferenceClassAccessTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package spoon.test.template.testclasses; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import spoon.reflect.reference.CtTypeReference; | ||
import spoon.template.ExtensionTemplate; | ||
import spoon.template.Local; | ||
import spoon.template.Parameter; | ||
|
||
public class TypeReferenceClassAccessTemplate extends ExtensionTemplate { | ||
Object o; | ||
|
||
$Type$ someMethod($Type$ param) { | ||
o = $Type$.out; | ||
o = $Type$.currentTimeMillis(); | ||
o = $Type$.class; | ||
o = o instanceof $Type$; | ||
Supplier<Long> p = $Type$::currentTimeMillis; | ||
return new $Type$(); | ||
} | ||
|
||
@Local | ||
public TypeReferenceClassAccessTemplate(CtTypeReference<?> typeRef) { | ||
this.typeRef = typeRef; | ||
} | ||
|
||
@Parameter("$Type$") | ||
CtTypeReference<?> typeRef; | ||
|
||
@Local | ||
static class $Type$ { | ||
static final String out = ""; | ||
static long currentTimeMillis(){ | ||
return 0; | ||
} | ||
} | ||
|
||
public static class Example<T> { | ||
static final String out = ""; | ||
static long currentTimeMillis(){ | ||
return 0; | ||
} | ||
} | ||
} |