diff --git a/PeerAtCodeParser.jar b/PeerAtCodeParser.jar index fc3a34b..20123a4 100644 Binary files a/PeerAtCodeParser.jar and b/PeerAtCodeParser.jar differ diff --git a/src/dev/peerat/mapping/TreasureProcessor.java b/src/dev/peerat/mapping/TreasureProcessor.java index b2c9187..4b5929e 100644 --- a/src/dev/peerat/mapping/TreasureProcessor.java +++ b/src/dev/peerat/mapping/TreasureProcessor.java @@ -21,6 +21,8 @@ import javax.tools.StandardLocation; import be.jeffcheasey88.peeratcode.parser.Parser; import be.jeffcheasey88.peeratcode.parser.TokenValidator; +import be.jeffcheasey88.peeratcode.parser.java.Annotation; +import be.jeffcheasey88.peeratcode.parser.java.Class; import be.jeffcheasey88.peeratcode.parser.java.JavaElement; import be.jeffcheasey88.peeratcode.parser.java.JavaFile; import be.jeffcheasey88.peeratcode.parser.java.JavaParser; @@ -75,6 +77,7 @@ public class TreasureProcessor extends AbstractProcessor{ process(source, output, file, javaFile); }catch(Exception ex){ error(source, output, file, ex); + throw ex; } } @@ -83,16 +86,35 @@ public class TreasureProcessor extends AbstractProcessor{ File parent = out.getParentFile(); if(!parent.exists()) parent.mkdirs(); if(!out.exists()) out.createNewFile(); - BufferedWriter writer = new BufferedWriter(new FileWriter(out)); - PARSER.build(writer); +// BufferedWriter writer = new BufferedWriter(new FileWriter(out)); +// PARSER.build(writer); + if(TokenValidator.TOKENS != TokenValidator.MAX_VALIDATE) throw new Exception(TokenValidator.TOKENS +" < "+TokenValidator.MAX_VALIDATE); + + Class treasure = file.find((element) -> { + if(element instanceof Class){ + Class c = (Class)element; + return c.find((subelement) -> { + if(subelement instanceof Annotation){ + Annotation annotation = (Annotation)subelement; + if(annotation.getName().getValue().equals("Treasure")) return true; //can also be dev.peerat.mapping.Treasure + } + return false; + }) != null; + } + return false; + }); + if(treasure != null){ + + } } private void error(File source, File output, File clazz, Exception e) throws Exception{ - File out = new File(output, clazz.getAbsolutePath().substring(source.getAbsolutePath().length())); + File out = new File(output, "log.txt"); File parent = out.getParentFile(); if(!parent.exists()) parent.mkdirs(); if(!out.exists()) out.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter(out)); + writer.write(clazz.getAbsolutePath()+"\n"); writer.write(e.getMessage()+"\n"); for(StackTraceElement trace : e.getStackTrace()){ writer.write(trace+"\n");