From cf00fb803b84283f29947fcb72c7c08d8acad4e3 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 27 Jan 2021 21:01:41 +0100 Subject: [PATCH] Checkstyle-Fehler behoben --- pom.xml | 1 - .../edu/kit/typicalc/model/parser/LambdaLexer.java | 2 +- .../kit/typicalc/model/parser/LambdaParser.java | 8 ++++---- .../java/edu/kit/typicalc/model/term/VarTerm.java | 8 ++++++-- .../kit/typicalc/view/TypicalcI18NProvider.java | 14 +++++++------- src/main/resources/application.properties | 2 -- src/test/resources/checkstyle.xml | 6 +++--- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index b435ef6..5630b1d 100644 --- a/pom.xml +++ b/pom.xml @@ -163,7 +163,6 @@ ${project.build.directory}/../src/test/resources/checkstyle.xml true warning - ${project.build.directory}/../src/main/java diff --git a/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java b/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java index 252c167..b2a6401 100644 --- a/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java +++ b/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java @@ -66,7 +66,7 @@ public class LambdaLexer { return new Result<>(t); case '\\': case 'λ': - t = new Token(TokenType.LAMBDA, c+"", pos); + t = new Token(TokenType.LAMBDA, c + "", pos); advance(); return new Result<>(t); default: diff --git a/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java b/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java index 2625ec9..e6a8924 100644 --- a/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java +++ b/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java @@ -27,7 +27,7 @@ public class LambdaParser { */ private Token token; - private static final Set atomStartTokens + private static final Set ATOM_START_TOKENS = EnumSet.of(TokenType.VARIABLE, TokenType.NUMBER, TokenType.TRUE, TokenType.FALSE, TokenType.LP); @@ -97,11 +97,11 @@ public class LambdaParser { nextToken(); Result var = parseVar(); if (!expect(TokenType.DOT)) { - // TODO + return new Result<>(null, ParseError.UNEXPECTED_TOKEN); } Result body = parseTerm(); // TODO: Fehlerbehandlung - return new Result(new AbsTerm(var.unwrap(), body.unwrap())); + return new Result<>(new AbsTerm(var.unwrap(), body.unwrap())); } /** @@ -110,7 +110,7 @@ public class LambdaParser { */ private Result parseApplication() { LambdaTerm left = parseAtom().unwrap(); // TODO: Fehlerbehandlung - while (atomStartTokens.contains(token.getType())) { + while (ATOM_START_TOKENS.contains(token.getType())) { LambdaTerm atom = parseAtom().unwrap(); // TODO: Fehlerbehandlung left = new AppTerm(left, atom); } diff --git a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java index e803363..fa67492 100644 --- a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java +++ b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java @@ -12,8 +12,12 @@ public class VarTerm extends LambdaTerm { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } VarTerm varTerm = (VarTerm) o; return Objects.equals(name, varTerm.name); } diff --git a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java index 57b939e..adf0db2 100644 --- a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java +++ b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java @@ -12,13 +12,13 @@ import com.vaadin.flow.i18n.I18NProvider; @Component /** - * Provides a simple implementation of the I18NProvider. + * Provides a simple implementation of the I18NProvider. * Allows for multiple languages and retrieving static Strings from .property-files. */ public class TypicalcI18NProvider implements I18NProvider { - + private static final long serialVersionUID = 8261479587838699070L; - + /** * Prefix of all .property-files */ @@ -31,12 +31,12 @@ public class TypicalcI18NProvider implements I18NProvider { @Override public String getTranslation(String key, Locale locale, Object... params) { - if(key == null) { + if (key == null) { return StringUtils.EMPTY; } - + String translation; - + try { final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PREFIX, locale); translation = bundle.getString(key); @@ -44,7 +44,7 @@ public class TypicalcI18NProvider implements I18NProvider { throw new IllegalStateException("this should never happen:" + " either an invalid locale is set or an invalid key is provided."); } - + return translation; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d579d9e..b5da9ee 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,6 +2,4 @@ server.port=${PORT:8080} logging.level.org.atmosphere = warn spring.mustache.check-template-location = false -# To improve the performance during development. -# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters # vaadin.whitelisted-packages= org/vaadin/example diff --git a/src/test/resources/checkstyle.xml b/src/test/resources/checkstyle.xml index eeb91a6..3a97f7e 100644 --- a/src/test/resources/checkstyle.xml +++ b/src/test/resources/checkstyle.xml @@ -10,14 +10,15 @@ - property name="allowUndeclaredRTE" value="true"/--> - property name="suppressLoadErrors" value="true"/--> + + + @@ -27,7 +28,6 @@ -