Skip to content

Commit 1797ea6

Browse files
committed
NoArg: Support @embeddable JPA annotation (KT-15946)
1 parent 349095c commit 1797ea6

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/SimpleKotlinGradleIT.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,15 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
152152
assertSuccessful()
153153

154154
val classesDir = File(project.projectDir, "build/classes/main")
155-
val testClass = File(classesDir, "test/Test.class")
156-
assertTrue(testClass.exists())
157155

158-
checkBytecodeContains(testClass, "public <init>()V")
156+
fun checkClass(name: String) {
157+
val testClass = File(classesDir, "test/$name.class")
158+
assertTrue(testClass.exists())
159+
checkBytecodeContains(testClass, "public <init>()V")
160+
}
161+
162+
checkClass("Test")
163+
checkClass("Test2")
159164
}
160165
}
161166
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2010-2017 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* This file was copied from the javax.persistence :
19+
* https://github.com/eclipse/javax.persistence/blob/master/src/javax/persistence/Entity.java
20+
*/
21+
package javax.persistence;
22+
23+
import java.lang.annotation.Target;
24+
import java.lang.annotation.Retention;
25+
import java.lang.annotation.Documented;
26+
import static java.lang.annotation.ElementType.TYPE;
27+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
28+
29+
@Documented
30+
@Target(TYPE)
31+
@Retention(RUNTIME)
32+
public @interface Embeddable {
33+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
package test
22

33
@javax.persistence.Entity
4-
class Test(a: String, b: Int)
4+
class Test(a: String, b: Int)
5+
6+
@javax.persistence.Embeddable
7+
class Test2(a: String, b: Int)

plugins/noarg/noarg-cli/src/NoArgPlugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object NoArgConfigurationKeys {
4646

4747
class NoArgCommandLineProcessor : CommandLineProcessor {
4848
companion object {
49-
val SUPPORTED_PRESETS = mapOf("jpa" to listOf("javax.persistence.Entity"))
49+
val SUPPORTED_PRESETS = mapOf("jpa" to listOf("javax.persistence.Entity", "javax.persistence.Embeddable"))
5050

5151
val ANNOTATION_OPTION = CliOption("annotation", "<fqname>", "Annotation qualified names",
5252
required = false, allowMultipleOccurrences = true)

0 commit comments

Comments
 (0)