mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
fixed raw name handling for inner classes in Scala
This commit is contained in:
parent
725b1ecd6f
commit
430135aa6f
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mysema.codegen</groupId>
|
||||
<artifactId>codegen</artifactId>
|
||||
<version>0.5.3</version>
|
||||
<version>0.5.4</version>
|
||||
<name>Codegen</name>
|
||||
<description>Code generation and compilation for Java</description>
|
||||
|
||||
|
||||
@ -370,6 +370,11 @@ public class ScalaWriter extends AbstractCodeWriter<ScalaWriter> {
|
||||
fullName = StringUtils.capitalize(fullName);
|
||||
}
|
||||
String packageName = type.getPackageName();
|
||||
if (packageName != null && packageName.length() > 0) {
|
||||
fullName = packageName + "." + fullName.substring(packageName.length()+1).replace('.', '$');
|
||||
} else {
|
||||
fullName = fullName.replace('.', '$');
|
||||
}
|
||||
String rv = fullName;
|
||||
if (type.isPrimitive() && packageName.isEmpty()) {
|
||||
rv = Character.toUpperCase(rv.charAt(0)) + rv.substring(1);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.mysema.codegen;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@ -28,5 +30,23 @@ public class InnerClassesTest {
|
||||
|
||||
System.err.println(str.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Java() {
|
||||
StringWriter str = new StringWriter();
|
||||
JavaWriter writer = new JavaWriter(str);
|
||||
|
||||
assertEquals("com.mysema.codegen.InnerClassesTest.Entity",
|
||||
writer.getRawName(new ClassType(Entity.class)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Scala() {
|
||||
StringWriter str = new StringWriter();
|
||||
ScalaWriter writer = new ScalaWriter(str);
|
||||
|
||||
assertEquals("com.mysema.codegen.InnerClassesTest$Entity",
|
||||
writer.getRawName(new ClassType(Entity.class)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user