X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=javainspect.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Finspector%2Fjava%2Fmethods%2FAnnotation.java;h=d3f282fd152279764adc0b45fee8acf4c5a21175;hp=96e0d20468216b533d6430dd3d4ba79ac4882019;hb=b2f519fd934cd49afbb5cfc88b3d2be396af0afa;hpb=c36bb542027754d394639170b96348439257103b diff --git a/src/main/java/eu/svjatoslav/inspector/java/methods/Annotation.java b/src/main/java/eu/svjatoslav/inspector/java/methods/Annotation.java old mode 100644 new mode 100755 index 96e0d20..d3f282f --- a/src/main/java/eu/svjatoslav/inspector/java/methods/Annotation.java +++ b/src/main/java/eu/svjatoslav/inspector/java/methods/Annotation.java @@ -1,3 +1,12 @@ +/* + * JavaInspect - Utility to visualize java software + * Copyright (C) 2013-2020, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. + */ + package eu.svjatoslav.inspector.java.methods; import eu.svjatoslav.commons.string.tokenizer.InvalidSyntaxException; @@ -6,29 +15,32 @@ import eu.svjatoslav.commons.string.tokenizer.TokenizerMatch; public class Annotation { - private String name; + private String name; + + public Annotation(final Tokenizer tokenizer) throws InvalidSyntaxException { - public Annotation(final Tokenizer tokenizer) throws InvalidSyntaxException { + name = tokenizer.getNextToken().token; - name = tokenizer.getNextToken().token; + if (!tokenizer.consumeIfNextToken("(")) + return; - if (!tokenizer.probeNextToken("(")) - return; + int depth = 1; - int depth = 1; + while (true) { + final TokenizerMatch token = tokenizer.getNextToken(); - while (true) { - final TokenizerMatch token = tokenizer.getNextToken(); + if (token == null) + return; - if ("(".equals(token.token)) - depth++; - if (")".equals(token.token)) - depth--; + if ("(".equals(token.token)) + depth++; + if (")".equals(token.token)) + depth--; - if (depth == 0) - return; - } + if (depth == 0) + return; + } - } + } }