Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.7.4
-
Fix Version/s: None
-
Component/s: Stub generator / Joint compiler
-
Labels:None
-
Number of attachments :
Description
The Groovy Stub generator does not add a .class extension for Class usages in annotations. For example, generating stubs for the following doesn't work:
@Test(expected = IllegalArgumentException)
void shouldFailOnDifferentCurrencies() {
// impl
}
For more information, see GMAVEN-79
Issue Links
- is depended upon by
-
GMAVEN-79
Cannot use @Test(expected=...) without .class suffix
-
- is duplicated by
-
GROOVY-4517
Java stub generator does not set correct value for annotations that expect a Class as a value
-
See Groovy trunk, class JavaStubGenerator, line 624. Class literal is considered a VariableExpression (because we are still in phase conversion), and its source code is generated with ASTNode.getText(). Question is how to tell that it's a class literal. I was surprised that I could access the annotation attribute's type with "annotation.getClassNode().getTypeClass().getDeclaredMethod(key, null).getReturnType()". Hence I assume this solves the problem for referenced Java/Groovy classes that aren't part of the same compilation unit. For the rest we could think about applying some heuristics, unless there is a better approach I'm missing. Jochen, what's your take on this?