rodionmoiseev / c10n

A Java library, focused on making internationalisation more modular, easier to evolve and maintain, robust-to-change and IDE-friendly without excess of external tools.
Apache License 2.0
67 stars 10 forks source link

Unable to build c10n: DefaultCodeGenerator.ResourceFile(File, String) undefined and DefaultCodeGenerator.ResourceFile.localeSuffix uninitialized #1

Closed eclectice closed 12 years ago

eclectice commented 12 years ago

Eclipse IDE triggers a few warnings in

https://github.com/rodionmoiseev/c10n/blob/master/tools/src/main/java/c10n/tools/codegen/DefaultCodeGenerator.java SHA: a210e884194bc28d6606a1aa504e5aebdfb65a09

1) The constructor DefaultCodeGenerator.ResourceFile(File, String) is undefined at line 278 2) The blank final field localeSuffix may not have been initialized at line 285

    private List<ResourceFile> findResourceFiles(File baseFile) {
        File parentDir = baseFile.getParentFile();
        String baseName = baseFile.getName();
        List<ResourceFile> res = new ArrayList<ResourceFile>();
        for (File f : parentDir.listFiles()) {
            int p = f.getName().lastIndexOf(".properties");
            if (f.getName().startsWith(baseName) && p > 0) {
                String localeSuffix = null;
                if (p > baseName.length() + 1) {
                    localeSuffix = f.getName().substring(baseName.length() + 1,
                            p);
                }
                res.add(new ResourceFile(f, localeSuffix));
            }
        }
        return res;
    }

    @Data
    private static final class ResourceFile {
        private final File file;
        private final String localeSuffix;
    }
rodionmoiseev commented 12 years ago

Thanks, I'll get that fixed.

eclectice commented 12 years ago

Thank you, rodion. I think I've solved it by simply creating a ResourceFile constructor that initializes its fields.

rodionmoiseev commented 12 years ago

Oh, I see. It's lombok that was the source of the problem. You need to download lombok.jar and add

-javaagent:lombok.jar
-Xbootclasspath/a:lombok.jar

to your eclipse.ini to get it to compile correctly.

But don't worry about it, I will get rid of lombok for now because it makes setup quite complicated. Thanks for spotting the problem!

rodionmoiseev commented 12 years ago

Lombok is now gone with cdfcf212de85e8b3f79f7f4a0809e1e06cf97461