NoArg: Support @Embeddable JPA annotation (KT-15946)

This commit is contained in:
Yan Zhulanow
2017-01-31 19:20:58 +03:00
parent 349095cd14
commit 1797ea62f4
4 changed files with 46 additions and 5 deletions
@@ -152,10 +152,15 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
assertSuccessful()
val classesDir = File(project.projectDir, "build/classes/main")
val testClass = File(classesDir, "test/Test.class")
assertTrue(testClass.exists())
checkBytecodeContains(testClass, "public <init>()V")
fun checkClass(name: String) {
val testClass = File(classesDir, "test/$name.class")
assertTrue(testClass.exists())
checkBytecodeContains(testClass, "public <init>()V")
}
checkClass("Test")
checkClass("Test2")
}
}
}
@@ -0,0 +1,33 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This file was copied from the javax.persistence :
* https://github.com/eclipse/javax.persistence/blob/master/src/javax/persistence/Entity.java
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public @interface Embeddable {
}
@@ -1,4 +1,7 @@
package test
@javax.persistence.Entity
class Test(a: String, b: Int)
class Test(a: String, b: Int)
@javax.persistence.Embeddable
class Test2(a: String, b: Int)
+1 -1
View File
@@ -46,7 +46,7 @@ object NoArgConfigurationKeys {
class NoArgCommandLineProcessor : CommandLineProcessor {
companion object {
val SUPPORTED_PRESETS = mapOf("jpa" to listOf("javax.persistence.Entity"))
val SUPPORTED_PRESETS = mapOf("jpa" to listOf("javax.persistence.Entity", "javax.persistence.Embeddable"))
val ANNOTATION_OPTION = CliOption("annotation", "<fqname>", "Annotation qualified names",
required = false, allowMultipleOccurrences = true)