Boolean as annotation parameter (java)
This commit is contained in:
+3
@@ -189,6 +189,9 @@ public final class JavaCompileTimeConstResolver {
|
|||||||
else if (literalValue instanceof Double) {
|
else if (literalValue instanceof Double) {
|
||||||
return new DoubleValue((Double) literalValue);
|
return new DoubleValue((Double) literalValue);
|
||||||
}
|
}
|
||||||
|
else if (literalValue instanceof Boolean) {
|
||||||
|
return ((Boolean) literalValue) ? BooleanValue.TRUE : BooleanValue.FALSE;
|
||||||
|
}
|
||||||
else if (literalValue == null) {
|
else if (literalValue == null) {
|
||||||
return NullValue.NULL;
|
return NullValue.NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
// TODO: remove comments when fix in idea will be accepted
|
||||||
|
public interface AnnotationWithPrimitiveValueInParam {
|
||||||
|
|
||||||
|
public @interface Ann {
|
||||||
|
int i();
|
||||||
|
// TODO short s();
|
||||||
|
// TODO byte b();
|
||||||
|
long l();
|
||||||
|
double d();
|
||||||
|
float f();
|
||||||
|
boolean bool();
|
||||||
|
// TODO char c();
|
||||||
|
String str();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ann(
|
||||||
|
i = 1,
|
||||||
|
//s = 1,
|
||||||
|
//b = 1,
|
||||||
|
l = 1l,
|
||||||
|
d = 1.0,
|
||||||
|
f = 1f,
|
||||||
|
bool = true,
|
||||||
|
//c = 'c',
|
||||||
|
str = "str"
|
||||||
|
)
|
||||||
|
class A { }
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public trait AnnotationWithPrimitiveValueInParam : java.lang.Object {
|
||||||
|
|
||||||
|
test.AnnotationWithPrimitiveValueInParam.Ann(bool = true: jet.Boolean, d = 1.0.toDouble(): jet.Double, f = 1.0.toFloat(): jet.Float, i = 1.toInt(): jet.Int, l = 1.toLong(): jet.Long, str = "str": jet.String) public open class A : java.lang.Object {
|
||||||
|
public constructor A()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final annotation class Ann : jet.Annotation {
|
||||||
|
public constructor Ann(/*0*/ i: jet.Int, /*1*/ l: jet.Long, /*2*/ d: jet.Double, /*3*/ f: jet.Float, /*4*/ bool: jet.Boolean, /*5*/ str: jet.String?)
|
||||||
|
public abstract fun bool(): jet.Boolean
|
||||||
|
public abstract fun d(): jet.Double
|
||||||
|
public abstract fun f(): jet.Float
|
||||||
|
public abstract fun i(): jet.Int
|
||||||
|
public abstract fun l(): jet.Long
|
||||||
|
public abstract fun str(): jet.String?
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1080,6 +1080,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/annotations/AnnotationWithEnumInParam.java");
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/annotations/AnnotationWithEnumInParam.java");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AnnotationWithPrimitiveValueInParam.java")
|
||||||
|
public void testAnnotationWithPrimitiveValueInParam() throws Exception {
|
||||||
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/annotations/AnnotationWithPrimitiveValueInParam.java");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("CustomAnnotation.java")
|
@TestMetadata("CustomAnnotation.java")
|
||||||
public void testCustomAnnotation() throws Exception {
|
public void testCustomAnnotation() throws Exception {
|
||||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.java");
|
doTestCompiledJava("compiler/testData/loadJava/compiledJava/annotations/CustomAnnotation.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user