METAGEN-78 Replacing @SupportedSourceVersion(RELEASE_6) with 'public SourceVersion getSupportedSourceVersion()'
This commit is contained in:
parent
f88284036f
commit
0f1cc39d9c
|
@ -12,41 +12,6 @@
|
|||
|
||||
<inceptionYear>2009</inceptionYear>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.0-api</artifactId>
|
||||
<version>1.0.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>5.8</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>3.6.0.Beta1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
|
@ -99,6 +64,41 @@
|
|||
<url>http://in.relation.to/Bloggers/Max</url>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.0-api</artifactId>
|
||||
<version>1.0.0.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>5.8</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>3.6.0.Beta1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>test</defaultGoal>
|
||||
|
|
|
@ -27,7 +27,7 @@ import javax.annotation.processing.ProcessingEnvironment;
|
|||
import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.annotation.processing.SupportedOptions;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
|
@ -51,8 +51,6 @@ import org.hibernate.jpamodelgen.util.StringUtil;
|
|||
import org.hibernate.jpamodelgen.util.TypeUtils;
|
||||
import org.hibernate.jpamodelgen.xml.XmlParser;
|
||||
|
||||
import static javax.lang.model.SourceVersion.RELEASE_6;
|
||||
|
||||
/**
|
||||
* Main annotation processor.
|
||||
*
|
||||
|
@ -63,7 +61,6 @@ import static javax.lang.model.SourceVersion.RELEASE_6;
|
|||
@SupportedAnnotationTypes({
|
||||
"javax.persistence.Entity", "javax.persistence.MappedSuperclass", "javax.persistence.Embeddable"
|
||||
})
|
||||
@SupportedSourceVersion(RELEASE_6)
|
||||
@SupportedOptions({
|
||||
JPAMetaModelEntityProcessor.DEBUG_OPTION,
|
||||
JPAMetaModelEntityProcessor.PERSISTENCE_XML_OPTION,
|
||||
|
@ -84,6 +81,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
public void init(ProcessingEnvironment env) {
|
||||
super.init( env );
|
||||
context = new Context( env );
|
||||
|
@ -107,10 +105,15 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.latestSupported();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment) {
|
||||
// see also METAGEN-45
|
||||
if ( roundEnvironment.processingOver() || annotations.size() == 0) {
|
||||
if ( roundEnvironment.processingOver() || annotations.size() == 0 ) {
|
||||
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.hibernate.jpamodelgen.test.arraytype;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
|
|
@ -167,11 +167,11 @@ public class TestUtil {
|
|||
public static void assertAttributeTypeInMetaModelFor(Class<?> clazz, String fieldName, Class<?> expectedType, String errorString) {
|
||||
Field field = getFieldFromMetamodelFor( clazz, fieldName );
|
||||
assertNotNull( field, "Cannot find field '" + fieldName + "' in " + clazz.getName() );
|
||||
ParameterizedType type = ( ParameterizedType ) field.getGenericType();
|
||||
ParameterizedType type = (ParameterizedType) field.getGenericType();
|
||||
Type actualType = type.getActualTypeArguments()[1];
|
||||
if ( expectedType.isArray() ) {
|
||||
expectedType = expectedType.getComponentType();
|
||||
actualType = ( ( GenericArrayType ) actualType ).getGenericComponentType();
|
||||
actualType = getComponentType( actualType );
|
||||
}
|
||||
assertEquals(
|
||||
actualType,
|
||||
|
@ -183,7 +183,7 @@ public class TestUtil {
|
|||
public static void assertMapAttributesInMetaModelFor(Class<?> clazz, String fieldName, Class<?> expectedMapKey, Class<?> expectedMapValue, String errorString) {
|
||||
Field field = getFieldFromMetamodelFor( clazz, fieldName );
|
||||
assertNotNull( field );
|
||||
ParameterizedType type = ( ParameterizedType ) field.getGenericType();
|
||||
ParameterizedType type = (ParameterizedType) field.getGenericType();
|
||||
Type actualMapKeyType = type.getActualTypeArguments()[1];
|
||||
assertEquals( actualMapKeyType, expectedMapKey, errorString );
|
||||
|
||||
|
@ -191,7 +191,6 @@ public class TestUtil {
|
|||
assertEquals( actualMapKeyValue, expectedMapValue, errorString );
|
||||
}
|
||||
|
||||
|
||||
public static void assertSuperClassRelationShipInMetamodel(Class<?> entityClass, Class<?> superEntityClass) {
|
||||
String entityModelClassName = entityClass.getName() + META_MODEL_CLASS_POSTFIX;
|
||||
String superEntityModelClassName = superEntityClass.getName() + META_MODEL_CLASS_POSTFIX;
|
||||
|
@ -238,6 +237,25 @@ public class TestUtil {
|
|||
return getFieldFromMetamodelFor( clazz, fieldName ) != null;
|
||||
}
|
||||
|
||||
private static Type getComponentType(Type actualType) {
|
||||
if ( actualType instanceof Class ) {
|
||||
Class<?> clazz = (Class<?>) actualType;
|
||||
if ( clazz.isArray() ) {
|
||||
return clazz.getComponentType();
|
||||
}
|
||||
else {
|
||||
fail("Unexpected component type");
|
||||
}
|
||||
}
|
||||
|
||||
if ( actualType instanceof GenericArrayType ) {
|
||||
return ( (GenericArrayType) actualType ).getGenericComponentType();
|
||||
} else {
|
||||
fail("Unexpected component type");
|
||||
return null; // making the compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
private static class MetaModelFilenameFilter implements FileFilter {
|
||||
@Override
|
||||
public boolean accept(File pathName) {
|
||||
|
|
Loading…
Reference in New Issue