METAGEN-10
Switched to using Diagnostic.Kind.OTHER for debug messages. Only message in default mode is now "Hibernate JPA 2 Static-Metamodel Generator [version]"
This commit is contained in:
parent
76d2d32a4a
commit
d5f15a172f
|
@ -80,6 +80,32 @@
|
|||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jboss.maven.plugins</groupId>
|
||||
<artifactId>maven-injection-plugin</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>bytecode</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<bytecodeInjections>
|
||||
<bytecodeInjection>
|
||||
<expression>${pom.version}</expression>
|
||||
<targetMembers>
|
||||
<methodBodyReturn>
|
||||
<className>org.hibernate.jpamodelgen.Version</className>
|
||||
<methodName>getVersionString</methodName>
|
||||
</methodBodyReturn>
|
||||
</targetMembers>
|
||||
</bytecodeInjection>
|
||||
</bytecodeInjections>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
@ -111,6 +137,7 @@
|
|||
<inherited>true</inherited>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
@ -123,6 +150,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
|
@ -142,6 +170,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-test-report</id>
|
||||
|
@ -174,7 +203,9 @@
|
|||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
@ -185,7 +216,9 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/dist.xml</descriptor>
|
||||
|
|
|
@ -106,7 +106,7 @@ public class Context {
|
|||
//does not work for Entity (risk of circularity)
|
||||
public void processElement(TypeElement element, AccessType defaultAccessTypeForHierarchy) {
|
||||
if ( elementsAlreadyProcessed.contains( element.getQualifiedName().toString() ) ) {
|
||||
logMessage( Diagnostic.Kind.WARNING, "Element already processed (ignoring): " + element );
|
||||
logMessage( Diagnostic.Kind.OTHER, "Element already processed (ignoring): " + element );
|
||||
return;
|
||||
}
|
||||
ClassWriter.writeFile( new AnnotationMetaEntity( element, this, defaultAccessTypeForHierarchy ), this );
|
||||
|
@ -115,7 +115,7 @@ public class Context {
|
|||
}
|
||||
|
||||
public void logMessage(Diagnostic.Kind type, String message) {
|
||||
if ( !logDebug && type.equals( Diagnostic.Kind.NOTE ) ) {
|
||||
if ( !logDebug && type.equals( Diagnostic.Kind.OTHER ) ) {
|
||||
return;
|
||||
}
|
||||
pe.getMessager().printMessage( type, message );
|
||||
|
|
|
@ -85,7 +85,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
public void init(ProcessingEnvironment env) {
|
||||
super.init( env );
|
||||
context = new Context( env );
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Init Processor " + this );
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Hibernate JPA 2 Static-Metamodel Generator " + Version.getVersionString() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,9 +93,9 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
final RoundEnvironment roundEnvironment) {
|
||||
|
||||
if ( roundEnvironment.processingOver() ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Last processing round." );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Last processing round." );
|
||||
createMetaModelClasses();
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Finished processing" );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Finished processing" );
|
||||
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
|
||||
}
|
||||
|
||||
|
@ -104,13 +104,13 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
}
|
||||
|
||||
if ( !hostJPAAnnotations( annotations ) ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Current processing round does not contain entities" );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Current processing round does not contain entities" );
|
||||
return ALLOW_OTHER_PROCESSORS_TO_CLAIM_ANNOTATIONS;
|
||||
}
|
||||
|
||||
Set<? extends Element> elements = roundEnvironment.getRootElements();
|
||||
for ( Element element : elements ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Processing " + element.toString() );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Processing " + element.toString() );
|
||||
handleRootElementAnnotationMirrors( element );
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
|
||||
private void createMetaModelClasses() {
|
||||
for ( MetaEntity entity : context.getMetaEntitiesToProcess().values() ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Writing meta model for " + entity );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Writing meta model for " + entity );
|
||||
ClassWriter.writeFile( entity, context );
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
}
|
||||
|
||||
for ( MetaEntity entity : context.getMetaSuperclassAndEmbeddableToProcess().values() ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Writing meta model for " + entity );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Writing meta model for " + entity );
|
||||
ClassWriter.writeFile( entity, context );
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
private InputStream getInputStreamForResource(String resource) {
|
||||
String pkg = getPackage( resource );
|
||||
String name = getRelativeName( resource );
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Reading resource " + resource );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Reading resource " + resource );
|
||||
InputStream ormStream;
|
||||
try {
|
||||
FileObject fileObject = processingEnv.getFiler().getResource( StandardLocation.CLASS_OUTPUT, pkg, name );
|
||||
|
@ -373,7 +373,7 @@ public class JPAMetaModelEntityProcessor extends AbstractProcessor {
|
|||
InputStream stream = getInputStreamForResource( resource );
|
||||
|
||||
if ( stream == null ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, resource + " not found." );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, resource + " not found." );
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
// $Id:$
|
||||
/*
|
||||
* JBoss, Home of Professional Open Source
|
||||
* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
|
||||
* by the @authors tag. See the copyright.txt in the distribution for a
|
||||
* full listing of individual contributors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.hibernate.jpamodelgen;
|
||||
|
||||
/**
|
||||
* Information about the Meta Model Generator version.
|
||||
*
|
||||
* @author Hardy Ferentschik
|
||||
*/
|
||||
public class Version {
|
||||
public static String getVersionString() {
|
||||
return "[WORKING]";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,14 +206,14 @@ public class AnnotationMetaEntity implements MetaEntity {
|
|||
}
|
||||
|
||||
private AccessType getAccessTypeForClass(TypeElement searchedElement) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "check class " + searchedElement );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "check class " + searchedElement );
|
||||
AccessType accessType = context.getAccessType( searchedElement );
|
||||
|
||||
if ( defaultAccessTypeForHierarchy == null ) {
|
||||
this.defaultAccessTypeForHierarchy = context.getDefaultAccessTypeForHerarchy( searchedElement );
|
||||
}
|
||||
if ( accessType != null ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Found in cache" + searchedElement + ":" + accessType );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Found in cache" + searchedElement + ":" + accessType );
|
||||
return accessType;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class AnnotationMetaEntity implements MetaEntity {
|
|||
final Access accessAnn = searchedElement.getAnnotation( Access.class );
|
||||
AccessType forcedAccessType = accessAnn != null ? accessAnn.value() : null;
|
||||
if ( forcedAccessType != null ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "access type " + searchedElement + ":" + forcedAccessType );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "access type " + searchedElement + ":" + forcedAccessType );
|
||||
context.addAccessType( searchedElement, forcedAccessType );
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class AnnotationMetaEntity implements MetaEntity {
|
|||
//FIXME consider XML
|
||||
if ( annotationType.equals( Id.class.getName() )
|
||||
|| annotationType.equals( EmbeddedId.class.getName() ) ) {
|
||||
context.logMessage( Diagnostic.Kind.NOTE, "Found id on" + searchedElement );
|
||||
context.logMessage( Diagnostic.Kind.OTHER, "Found id on" + searchedElement );
|
||||
final ElementKind kind = subElement.getKind();
|
||||
if ( kind == ElementKind.FIELD || kind == ElementKind.METHOD ) {
|
||||
accessType = kind == ElementKind.FIELD ? AccessType.FIELD : AccessType.PROPERTY;
|
||||
|
@ -264,7 +264,7 @@ public class AnnotationMetaEntity implements MetaEntity {
|
|||
if ( forcedAccessType == null ) {
|
||||
context.addAccessType( searchedElement, accessType );
|
||||
context.logMessage(
|
||||
Diagnostic.Kind.NOTE, "access type " + searchedElement + ":" + accessType
|
||||
Diagnostic.Kind.OTHER, "access type " + searchedElement + ":" + accessType
|
||||
);
|
||||
return accessType;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue