removed guava

This commit is contained in:
Ulrich Wolffgang
2019-01-07 21:41:53 +01:00
parent b0cdf260c6
commit 5768c5abd9
13 changed files with 54 additions and 58 deletions

23
pom.xml
View File

@@ -21,7 +21,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<antlr.version>4.7</antlr.version>
<antlr.version>4.7.2</antlr.version>
</properties>
<build>
<resources>
@@ -49,11 +49,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -62,14 +57,10 @@
<argLine>-Xmx2048m -Djava.awt.headless=true</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.7</version>
<version>${antlr.version}</version>
<executions>
<execution>
<id>run antlr</id>
@@ -113,6 +104,11 @@
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
@@ -123,11 +119,6 @@
<artifactId>antlr4-runtime</artifactId>
<version>${antlr.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@@ -15,8 +15,6 @@ import java.util.Map;
import org.antlr.v4.runtime.CommonTokenStream;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.ArgContext;
import io.proleap.vb6.VisualBasic6Parser.AttributeStmtContext;
import io.proleap.vb6.VisualBasic6Parser.DeclareStmtContext;
@@ -525,7 +523,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
@Override
public List<Function> getFunctions() {
return Lists.newArrayList(functions.values());
return new ArrayList<>(functions.values());
}
@Override
@@ -555,7 +553,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
@Override
public List<PropertyGet> getPropertyGets() {
return Lists.newArrayList(propertyGets.values());
return new ArrayList<>(propertyGets.values());
}
@Override
@@ -565,7 +563,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
@Override
public List<PropertyLet> getPropertyLets() {
return Lists.newArrayList(propertyLets.values());
return new ArrayList<>(propertyLets.values());
}
@Override
@@ -575,7 +573,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
@Override
public List<PropertySet> getPropertySets() {
return Lists.newArrayList(propertySets.values());
return new ArrayList<>(propertySets.values());
}
@Override
@@ -585,7 +583,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
final EnumerationConstant enumerationConstant = getEnumerationConstant(name);
if (enumerationConstant != null) {
result = new ArrayList<ScopedElement>();
result = new ArrayList<>();
result.add(enumerationConstant);
} else {
result = super.getScopedElementsInScope(name);
@@ -601,7 +599,7 @@ public abstract class ModuleImpl extends ScopeImpl implements Module {
@Override
public List<Sub> getSubs() {
return Lists.newArrayList(subs.values());
return new ArrayList<Sub>(subs.values());
}
@Override

View File

@@ -40,8 +40,6 @@ import org.antlr.v4.runtime.ParserRuleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser;
import io.proleap.vb6.VisualBasic6Parser.AmbiguousIdentifierContext;
import io.proleap.vb6.VisualBasic6Parser.AppActivateStmtContext;
@@ -2456,7 +2454,7 @@ public abstract class ScopeImpl extends ScopedElementImpl implements Scope {
@Override
public List<Constant> getConstants() {
return Lists.newArrayList(constants.values());
return new ArrayList<>(constants.values());
}
/**
@@ -2616,7 +2614,7 @@ public abstract class ScopeImpl extends ScopedElementImpl implements Scope {
@Override
public List<Variable> getVariables() {
return Lists.newArrayList(variables.values());
return new ArrayList<Variable>(variables.values());
}
protected void linkApiEnumerationCallWithApiEnumeration(final ApiEnumerationCall apiEnumerationCall,

View File

@@ -9,8 +9,7 @@
package io.proleap.vb6.asg.metamodel.impl;
import org.antlr.v4.runtime.ParserRuleContext;
import com.google.common.base.Strings;
import org.apache.commons.lang.StringUtils;
import io.proleap.vb6.asg.metamodel.Module;
import io.proleap.vb6.asg.metamodel.Program;
@@ -60,6 +59,6 @@ public abstract class ScopedElementImpl extends ASGElementImpl implements Scoped
}
protected String getSymbol(final String name) {
return Strings.isNullOrEmpty(name) ? name : name.toLowerCase();
return StringUtils.isEmpty(name) ? name : name.toLowerCase();
}
}

View File

@@ -13,8 +13,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.FunctionStmtContext;
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
import io.proleap.vb6.asg.metamodel.Module;
@@ -67,7 +65,7 @@ public class FunctionImpl extends ProcedureImpl implements Function {
@Override
public List<Call> getCalls() {
return Lists.newArrayList(getFunctionCalls());
return new ArrayList<>(getFunctionCalls());
}
@Override

View File

@@ -13,8 +13,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.PropertyGetStmtContext;
import io.proleap.vb6.asg.inference.impl.TypeInferenceImpl;
import io.proleap.vb6.asg.metamodel.Module;
@@ -67,7 +65,7 @@ public class PropertyGetImpl extends ProcedureImpl implements PropertyGet {
@Override
public List<Call> getCalls() {
return Lists.newArrayList(getPropertyGetCalls());
return new ArrayList<>(getPropertyGetCalls());
}
@Override

View File

@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.property.let.impl;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.PropertyLetStmtContext;
import io.proleap.vb6.asg.metamodel.Module;
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
@@ -45,7 +43,7 @@ public class PropertyLetImpl extends ProcedureImpl implements PropertyLet {
@Override
public List<Call> getCalls() {
return Lists.newArrayList(getPropertyLetCalls());
return new ArrayList<>(getPropertyLetCalls());
}
@Override

View File

@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.property.set.impl;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.PropertySetStmtContext;
import io.proleap.vb6.asg.metamodel.Module;
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
@@ -45,7 +43,7 @@ public class PropertySetImpl extends ProcedureImpl implements PropertySet {
@Override
public List<Call> getCalls() {
return Lists.newArrayList(getPropertySetCalls());
return new ArrayList<>(getPropertySetCalls());
}
@Override

View File

@@ -11,8 +11,6 @@ package io.proleap.vb6.asg.metamodel.statement.sub.impl;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
import io.proleap.vb6.VisualBasic6Parser.SubStmtContext;
import io.proleap.vb6.asg.metamodel.Module;
import io.proleap.vb6.asg.metamodel.VisibilityEnum;
@@ -44,7 +42,7 @@ public class SubImpl extends ProcedureImpl implements Sub {
@Override
public List<Call> getCalls() {
return Lists.newArrayList(getSubCalls());
return new ArrayList<>(getSubCalls());
}
@Override

View File

@@ -0,0 +1,24 @@
package io.proleap.vb6.asg.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.List;
import java.util.stream.Collectors;
public class StringUtils {
public static List<String> readLines(final InputStream inputStream, final Charset charset) throws IOException {
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset);
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
return bufferedReader.lines().collect(Collectors.toList());
}
public static String toString(final InputStream inputStream, final Charset charset) throws IOException {
final InputStreamReader inputStreamReader = new InputStreamReader(inputStream, charset);
final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
return bufferedReader.lines().collect(Collectors.joining(System.lineSeparator()));
}
}

View File

@@ -19,11 +19,10 @@ import java.util.Arrays;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Strings;
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
import io.proleap.vb6.util.TreeUtils;
@@ -111,7 +110,7 @@ public class TestGenerator {
subOutputDirectory.mkdirs();
// determine the package name of test classes
final String subPackageName = Strings.isNullOrEmpty(packageName) ? subInputDirectoryName
final String subPackageName = StringUtils.isEmpty(packageName) ? subInputDirectoryName
: packageName + "." + subInputDirectoryName;
generateTestClasses(subInputDirectory, subOutputDirectory, subPackageName);

View File

@@ -22,11 +22,10 @@ import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.Trees;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Strings;
import io.proleap.vb6.VisualBasic6Lexer;
import io.proleap.vb6.VisualBasic6Parser;
import io.proleap.vb6.VisualBasic6Parser.StartRuleContext;
@@ -59,7 +58,7 @@ public class VbParseTestRunnerImpl implements VbParseTestRunner {
final String treeFileData = FileUtils.readFileToString(treeFile, StandardCharsets.UTF_8);
if (!Strings.isNullOrEmpty(treeFileData)) {
if (!StringUtils.isEmpty(treeFileData)) {
LOG.info("Comparing parse tree with file {}.", treeFile.getName());
final String inputFileTree = Trees.toStringTree(startRule, parser);

View File

@@ -7,9 +7,7 @@ import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.misc.Utils;
import org.antlr.v4.runtime.tree.Tree;
import org.antlr.v4.runtime.tree.Trees;
import org.sonatype.inject.Nullable;
import com.google.common.base.Strings;
import org.apache.commons.lang.StringUtils;
public class TreeUtils {
@@ -18,13 +16,13 @@ public class TreeUtils {
public static final String TAB = "\t";
public static String indent(final int indent) {
return Strings.repeat(TAB, indent);
return StringUtils.repeat(TAB, indent);
}
/**
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, List<String>)
*/
public static String toStringTree(final Tree t, @Nullable final List<String> ruleNames, final int depth) {
public static String toStringTree(final Tree t, final List<String> ruleNames, final int depth) {
String s = Utils.escapeWhitespace(Trees.getNodeText(t, ruleNames), false);
if (t.getChildCount() == 0) {
@@ -59,7 +57,7 @@ public class TreeUtils {
/**
* @see org.antlr.v4.runtime.tree.Trees.toStringTree(Tree, Parser)
*/
public static String toStringTree(final Tree t, @Nullable final Parser recog) {
public static String toStringTree(final Tree t, final Parser recog) {
final String[] ruleNames = recog != null ? recog.getRuleNames() : null;
final List<String> ruleNamesList = ruleNames != null ? Arrays.asList(ruleNames) : null;