1515 */
1616package org .seasar .doma .internal .apt ;
1717
18- import static org .seasar .doma .internal .util .AssertionUtil .* ;
18+ import static org .seasar .doma .internal .util .AssertionUtil .assertNotNull ;
1919
2020import java .io .BufferedWriter ;
2121import java .io .IOException ;
2828import javax .tools .JavaFileObject ;
2929
3030import org .seasar .doma .internal .Artifact ;
31+ import org .seasar .doma .internal .Conventions ;
3132import org .seasar .doma .internal .apt .util .ElementUtil ;
3233import org .seasar .doma .internal .util .ClassUtil ;
3334import org .seasar .doma .message .Message ;
@@ -44,7 +45,7 @@ public abstract class AbstractGenerator implements Generator {
4445
4546 protected final TypeElement typeElement ;
4647
47- protected final String qualifiedName ;
48+ protected final String canonicalName ;
4849
4950 protected final String packageName ;
5051
@@ -72,24 +73,25 @@ protected AbstractGenerator(ProcessingEnvironment env,
7273 this .subpackage = subpackage ;
7374 this .prefix = prefix ;
7475 this .suffix = suffix ;
75- this .qualifiedName = createQualifiedName (env , typeElement , fullpackage ,
76+ this .canonicalName = createCanonicalName (env , typeElement , fullpackage ,
7677 subpackage , prefix , suffix );
77- this .packageName = ClassUtil .getPackageName (qualifiedName );
78- this .simpleName = ClassUtil .getSimpleName (qualifiedName );
78+ this .packageName = ClassUtil .getPackageName (canonicalName );
79+ this .simpleName = ClassUtil .getSimpleName (canonicalName );
7980 Filer filer = env .getFiler ();
8081 JavaFileObject file = filer
81- .createSourceFile (qualifiedName , typeElement );
82+ .createSourceFile (canonicalName , typeElement );
8283 formatter = new Formatter (new BufferedWriter (file .openWriter ()));
8384 }
8485
85- protected String createQualifiedName (ProcessingEnvironment env ,
86+ protected String createCanonicalName (ProcessingEnvironment env ,
8687 TypeElement typeElement , String fullpackage , String subpackage ,
8788 String prefix , String suffix ) {
8889 String qualifiedNamePrefix = getQualifiedNamePrefix (env , typeElement ,
8990 fullpackage , subpackage );
90- return qualifiedNamePrefix + prefix
91- + ElementUtil .getPackageExcludedBinaryName (typeElement , env )
92- + suffix ;
91+ String binaryName = Conventions .normalizeBinaryName (ElementUtil
92+ .getBinaryName (typeElement , env ));
93+ String infix = ClassUtil .getSimpleName (binaryName );
94+ return qualifiedNamePrefix + prefix + infix + suffix ;
9395 }
9496
9597 protected String getQualifiedNamePrefix (ProcessingEnvironment env ,
@@ -138,7 +140,7 @@ protected void throwExceptionIfNecessary() {
138140 if (ioException != null ) {
139141 formatter .close ();
140142 throw new AptException (Message .DOMA4079 , env , typeElement ,
141- ioException , qualifiedName , ioException );
143+ ioException , canonicalName , ioException );
142144 }
143145 }
144146
0 commit comments