Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeneratedJavaFile.java bug #97

Closed
beeant0512 opened this issue Jun 11, 2016 · 1 comment
Closed

GeneratedJavaFile.java bug #97

beeant0512 opened this issue Jun 11, 2016 · 1 comment
Labels
Milestone

Comments

@beeant0512
Copy link

when a write a plugin( extend PluginAdapter), i@Override contextGenerateAdditionalJavaFiles(IntrospectedTable introspectedTable)method, and i wrote thess codes:

superServiceInterfaceFqjt = new FullyQualifiedJavaType(superService);
superServiceInterfaceFqjt.addTypeArgument(new FullyQualifiedJavaType("T"));

Interface interfaze = new Interface(superServiceInterfaceFqjt);

GeneratedJavaFile javaFile = new GeneratedJavaFile(interfaze, context.getJavaModelGeneratorConfiguration()
                .getTargetProject(),
                context.getProperty(PropertyRegistry.CONTEXT_JAVA_FILE_ENCODING),
                context.getJavaFormatter());

when i run the code

java.io.FileNotFoundException: H:\javaweb\angular\src\main\java\com\beeant\common\service\IBaseService<T>.java (文件名、目录名或卷标语法不正确。)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at org.mybatis.generator.api.MyBatisGenerator.writeFile(MyBatisGenerator.java:381)
    at org.mybatis.generator.api.MyBatisGenerator.writeGeneratedJavaFile(MyBatisGenerator.java:326)
    at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:282)
    at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:138)
    at StartUp.main(StartUp.java:29)

in GeneratedJavaFile.java , i thought it is an bug to get the filename when a interface have argetments

@Override
    public String getFileName() {
        return compilationUnit.getType().getShortName() + ".java"; //$NON-NLS-1$
    }

here is what i Override

String fulllyQualifiedNameWithoutTypeParameterts = compilationUnit.getType().getFullyQualifiedNameWithoutTypeParameters();
        FullyQualifiedJavaType fullyQualifiedJavaType = new FullyQualifiedJavaType(fulllyQualifiedNameWithoutTypeParameterts);
        return fullyQualifiedJavaType.getShortName() + ".java"; //$NON-NLS-1$
@jeffgbutler
Copy link
Member

Good catch. Thanks for reporting this!

@jeffgbutler jeffgbutler added this to the 1.3.3 milestone Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants