Skip to content

Commit

Permalink
Revert "Spotbugs support (cherry picking commits, previously #4971)"
Browse files Browse the repository at this point in the history
  • Loading branch information
hasithaa authored Apr 7, 2018
1 parent 6df02cb commit 89c74f6
Show file tree
Hide file tree
Showing 84 changed files with 118 additions and 326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Package name="org.ballerinalang.model.values"/>
</Match>
<Match>
<Package name="org.ballerinalang.bre*"/>
<Package name="org.ballerinalang.bre"/>
</Match>
<Match>
<Package name="org.ballerinalang.model.statements"/>
Expand Down
9 changes: 3 additions & 6 deletions bvm/ballerina-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
<artifactId>opentracing-util</artifactId>
</dependency>
</dependencies>

<properties>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
<build>
<plugins>
<!-- For ballerina annotation processing -->
Expand All @@ -179,9 +181,4 @@
</plugin>
</plugins>
</build>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<maven.checkstyleplugin.excludes>**/generated/**</maven.checkstyleplugin.excludes>
</properties>
</project>
File renamed without changes.
2 changes: 1 addition & 1 deletion bvm/ballerina-logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
</dependencies>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
Empty file removed bvm/ballerina-observe/pom.xml
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion bvm/ballerina-streaming/siddhi-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>../spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>../findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
2 changes: 1 addition & 1 deletion bvm/ballerina-streaming/siddhi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

<properties>
<maven.checkstyleplugin.excludes>**/SiddhiDebuggerClient.java</maven.checkstyleplugin.excludes>
<maven.spotbugsplugin.exclude.file>../spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>../findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>

</project>
2 changes: 1 addition & 1 deletion bvm/ballerina-streaming/siddhi-query-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>../spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>../findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>

</project>
2 changes: 1 addition & 1 deletion bvm/ballerina-streaming/siddhi-query-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>../spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>../findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<maven.checkstyleplugin.excludes>
**/internal/**,
**org/ballerinalang/siddhi/query/compiler/*,
Expand Down
2 changes: 1 addition & 1 deletion cli/ballerina-cli-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@

<properties>
<ballerina.source.directory>${basedir}/src/main/ballerina</ballerina.source.directory>
<maven.findbugsplugin.exclude.file>findbugs-exclude.xml</maven.findbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<maven.checkstyleplugin.excludes>**/generated/**</maven.checkstyleplugin.excludes>
</properties>
</project>
File renamed without changes.
2 changes: 1 addition & 1 deletion cli/ballerina-launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
2 changes: 1 addition & 1 deletion cli/ballerina-packerina/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
2 changes: 1 addition & 1 deletion compiler/ballerina-lang/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<maven.checkstyleplugin.excludes>
**org/wso2/ballerinalang/compiler/parser/antlr4/*,
**/util/parser/*,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion composer/modules/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

<properties>
<microservice.mainClass>org.ballerinalang.composer.service.workspace.app.WorkspaceServiceRunner</microservice.mainClass>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<project.build.sourceEncoding>${file.encoding}</project.build.sourceEncoding>
<org.wso2.transport.http.version>6.0.63</org.wso2.transport.http.version>
<jackson.core.version>2.4.5</jackson.core.version>
Expand Down
2 changes: 1 addition & 1 deletion composer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<maven.checkstyleplugin.excludes>**/parser/*,**/${native.constructs.provider.class}.java</maven.checkstyleplugin.excludes>

<!-- Maven plugins -->
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<native.constructs.provider.package>org.ballerinalang.nativeimpl</native.constructs.provider.package>
<native.constructs.provider.class>BallerinaNativeConstructsProvider</native.constructs.provider.class>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions distribution/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mvn clean install
This will create a fat JAR file with the dependencies included, inside the `target` folder.

## Usage
Add the `ballerina-container-support-0.970.0-alpha1-SNAPSHOT-alpha1-SNAPSHOT.jar` file to `bre/lib/` folder in the Ballerina distribution.
Add the `ballerina-container-support-0.970.0-alpha1-SNAPSHOT.jar` file to `bre/lib/` folder in the Ballerina distribution.

### `ballerina docker` Command Line Usage
```
Expand Down Expand Up @@ -100,7 +100,7 @@ cp mypackage.balx ~/ballerina/packages/
chmod +r ~/ballerina/packages/mypackage.balx

# Run container with the volume mount
docker run -v ~/ballerina/packages:/ballerina/files -it ballerinalang/ballerina:0.970.0-alpha1-SNAPSHOT-alpha1-SNAPSHOT
docker run -v ~/ballerina/packages:/ballerina/files -it ballerinalang/ballerina:0.970.0-alpha1-SNAPSHOT
```

If you are running a Ballerina Service,
Expand All @@ -109,7 +109,7 @@ If you are running a Ballerina Service,
cp mysvcpackage.balx ~/ballerina/packages/
chmod +r ~/ballerina/packages/mysvcpackage.balx

docker run -v /tmp/testb:/ballerina/files -p 9090:9090 -it ballerinalang/ballerina:0.970.0-alpha1-SNAPSHOT-alpha1-SNAPSHOT
docker run -v /tmp/testb:/ballerina/files -p 9090:9090 -it ballerinalang/ballerina:0.970.0-alpha1-SNAPSHOT
```
## License
Ballerina Container Support is licensed under [Apache License v2](LICENSE).
Expand Down
4 changes: 2 additions & 2 deletions distribution/docker/ballerina-base-image/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function showUsageAndExit() {
echo
echo "USAGE: ./build.sh -d <ballerina-distribution> -v <image-version> -o <organization-name>"
echo
echo "Ex: Create a Ballerina Docker image tagged \"ballerina:latest\" with Ballerina 0.970.0-alpha1-SNAPSHOT-alpha1-SNAPSHOT distribution."
echo " ./build.sh -d ballerina-0.970.0-alpha1-SNAPSHOT-alpha1-SNAPSHOT.zip"
echo "Ex: Create a Ballerina Docker image tagged \"ballerina:latest\" with Ballerina 0.970.0-alpha1-SNAPSHOT distribution."
echo " ./build.sh -d ballerina-0.970.0-alpha1-SNAPSHOT.zip"
echo

exit
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions distribution/docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@
</build>

<properties>
<maven.spotbugsplugin.version.exclude>spotbugs-exclude.xml</maven.spotbugsplugin.version.exclude>
<maven.findbugsplugin.version.exclude>findbugs-exclude.xml</maven.findbugsplugin.version.exclude>
<surefireArgLine>-Dfile.encoding=UTF-8</surefireArgLine>
<jackson.version>2.6.1</jackson.version>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
2 changes: 1 addition & 1 deletion language-server/modules/langserver-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@

<properties>
<maven.checkstyleplugin.excludes>**/SourceGen.java</maven.checkstyleplugin.excludes>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,17 @@ public CompletableFuture<SignatureHelp> signatureHelp(TextDocumentPositionParams
signatureContext.put(DocumentServiceKeys.POSITION_KEY, position);
signatureContext.put(DocumentServiceKeys.FILE_URI_KEY, uri);
SignatureHelp signatureHelp;
BLangPackage bLangPackage = TextDocumentServiceUtil.getBLangPackage(signatureContext, documentManager,
false, LSCustomErrorStrategy.class, false).get(0);
signatureContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
SignatureTreeVisitor signatureTreeVisitor = new SignatureTreeVisitor(signatureContext);
bLangPackage.accept(signatureTreeVisitor);
signatureHelp = SignatureHelpUtil.getFunctionSignatureHelp(signatureContext);
try {
BLangPackage bLangPackage = TextDocumentServiceUtil.getBLangPackage(signatureContext, documentManager,
false, LSCustomErrorStrategy.class, false).get(0);
signatureContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
SignatureTreeVisitor signatureTreeVisitor = new SignatureTreeVisitor(signatureContext);
bLangPackage.accept(signatureTreeVisitor);
signatureHelp = SignatureHelpUtil.getFunctionSignatureHelp(signatureContext);
} catch (Exception e) {
signatureHelp = new SignatureHelp();
}
return signatureHelp;
});
}
Expand Down Expand Up @@ -226,27 +230,31 @@ public CompletableFuture<List<? extends Location>> references(ReferenceParams pa
referenceContext.put(DocumentServiceKeys.POSITION_KEY, params);
List<Location> contents = new ArrayList<>();

List<BLangPackage> bLangPackages = TextDocumentServiceUtil
.getBLangPackage(referenceContext, documentManager, false,
LSCustomErrorStrategy.class, true);
// Get the current package.
BLangPackage currentBLangPackage = CommonUtil.getCurrentPackageByFileName(bLangPackages,
params.getTextDocument().getUri());
try {
List<BLangPackage> bLangPackages = TextDocumentServiceUtil
.getBLangPackage(referenceContext, documentManager, false,
LSCustomErrorStrategy.class, true);
// Get the current package.
BLangPackage currentBLangPackage = CommonUtil.getCurrentPackageByFileName(bLangPackages,
params.getTextDocument().getUri());

referenceContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
currentBLangPackage.symbol.getName().getValue());
referenceContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
currentBLangPackage.symbol.getName().getValue());

// Calculate position for the current package.
PositionTreeVisitor positionTreeVisitor = new PositionTreeVisitor(referenceContext);
currentBLangPackage.accept(positionTreeVisitor);
// Calculate position for the current package.
PositionTreeVisitor positionTreeVisitor = new PositionTreeVisitor(referenceContext);
currentBLangPackage.accept(positionTreeVisitor);

// Run reference visitor for all the packages in project folder.
for (BLangPackage bLangPackage : bLangPackages) {
referenceContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
LSPackageCache.getInstance().addPackage(bLangPackage.packageID, bLangPackage);
referenceContext.put(NodeContextKeys.REFERENCE_NODES_KEY, contents);
contents = ReferenceUtil.getReferences(referenceContext, bLangPackage);
// Run reference visitor for all the packages in project folder.
for (BLangPackage bLangPackage : bLangPackages) {
referenceContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
LSPackageCache.getInstance().addPackage(bLangPackage.packageID, bLangPackage);
referenceContext.put(NodeContextKeys.REFERENCE_NODES_KEY, contents);
contents = ReferenceUtil.getReferences(referenceContext, bLangPackage);
}
} catch (Exception e) {
// Ignore
}

return contents;
Expand Down Expand Up @@ -331,12 +339,16 @@ public CompletableFuture<List<? extends TextEdit>> formatting(DocumentFormatting
int totalLines = contentComponents.length;

Range range = new Range(new Position(0, 0), new Position(totalLines, lastCharCol));
// Source generation for given ast.
JsonObject ast = TextDocumentFormatUtil.getAST(params, documentManager, formatContext);
SourceGen sourceGen = new SourceGen(0);
sourceGen.build(ast.getAsJsonObject("model"), null, "CompilationUnit");
textEditContent = sourceGen.getSourceOf(ast.getAsJsonObject("model"), true, false);
TextEdit textEdit = new TextEdit(range, textEditContent);
try {
// Source generation for given ast.
JsonObject ast = TextDocumentFormatUtil.getAST(params, documentManager, formatContext);
SourceGen sourceGen = new SourceGen(0);
sourceGen.build(ast.getAsJsonObject("model"), null, "CompilationUnit");
textEditContent = sourceGen.getSourceOf(ast.getAsJsonObject("model"), true, false);
} catch (Exception e) {
// Ignore
}
TextEdit textEdit = textEditContent != null ? new TextEdit(range, textEditContent) : null;
return Collections.singletonList(textEdit);
});
}
Expand All @@ -361,33 +373,37 @@ public CompletableFuture<WorkspaceEdit> rename(RenameParams params) {
new TextDocumentPositionParams(params.getTextDocument(), params.getPosition()));
List<Location> contents = new ArrayList<>();

List<BLangPackage> bLangPackages =
TextDocumentServiceUtil.getBLangPackage(renameContext, documentManager, false,
LSCustomErrorStrategy.class, true);
// Get the current package.
BLangPackage currentBLangPackage = CommonUtil.getCurrentPackageByFileName(bLangPackages,
params.getTextDocument().getUri());
try {
List<BLangPackage> bLangPackages =
TextDocumentServiceUtil.getBLangPackage(renameContext, documentManager, false,
LSCustomErrorStrategy.class, true);
// Get the current package.
BLangPackage currentBLangPackage = CommonUtil.getCurrentPackageByFileName(bLangPackages,
params.getTextDocument().getUri());

renameContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
currentBLangPackage.symbol.getName().getValue());
renameContext.put(NodeContextKeys.REFERENCE_NODES_KEY, contents);
renameContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
currentBLangPackage.symbol.getName().getValue());
renameContext.put(NodeContextKeys.REFERENCE_NODES_KEY, contents);

// Run the position calculator for the current package.
PositionTreeVisitor positionTreeVisitor = new PositionTreeVisitor(renameContext);
currentBLangPackage.accept(positionTreeVisitor);
String replaceableSymbolName = renameContext.get(NodeContextKeys.NAME_OF_NODE_KEY);
// Run the position calculator for the current package.
PositionTreeVisitor positionTreeVisitor = new PositionTreeVisitor(renameContext);
currentBLangPackage.accept(positionTreeVisitor);
String replaceableSymbolName = renameContext.get(NodeContextKeys.NAME_OF_NODE_KEY);

// Run reference visitor and rename util for project folder.
for (BLangPackage bLangPackage : bLangPackages) {
renameContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
LSPackageCache.getInstance().addPackage(bLangPackage.packageID, bLangPackage);
// Run reference visitor and rename util for project folder.
for (BLangPackage bLangPackage : bLangPackages) {
renameContext.put(DocumentServiceKeys.CURRENT_PACKAGE_NAME_KEY,
bLangPackage.symbol.getName().getValue());
LSPackageCache.getInstance().addPackage(bLangPackage.packageID, bLangPackage);

contents = ReferenceUtil.getReferences(renameContext, bLangPackage);
}
contents = ReferenceUtil.getReferences(renameContext, bLangPackage);
}

workspaceEdit.setDocumentChanges(RenameUtil
.getRenameTextEdits(contents, documentManager, params.getNewName(), replaceableSymbolName));
workspaceEdit.setDocumentChanges(RenameUtil
.getRenameTextEdits(contents, documentManager, params.getNewName(), replaceableSymbolName));
} catch (Exception e) {
// Ignore exception and will return the empty workspace edits list
}
return workspaceEdit;
});
}
Expand Down Expand Up @@ -479,8 +495,8 @@ private void publishDiagnostics(List<org.ballerinalang.util.diagnostic.Diagnosti


String fileName = diagnostic.getPosition().getSource().getCompilationUnitName();
Path filePath = Paths.get(path.getParent() + "", fileName);
String fileURI = filePath.toUri().toString() + "";
Path filePath = Paths.get(path.getParent().toString(), fileName);
String fileURI = filePath.toUri().toString();

if (!diagnosticsMap.containsKey(fileURI)) {
diagnosticsMap.put(fileURI, new ArrayList<Diagnostic>());
Expand Down
2 changes: 1 addition & 1 deletion language-server/modules/launchers/stdio-launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</build>

<properties>
<maven.spotbugsplugin.exclude.file>spotbugs-exclude.xml</maven.spotbugsplugin.exclude.file>
<mavan.findbugsplugin.exclude.file>findbugs-exclude.xml</mavan.findbugsplugin.exclude.file>
<maven.shadeplugin.version>2.4.1</maven.shadeplugin.version>
</properties>
</project>
2 changes: 1 addition & 1 deletion language-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dependencyManagement>

<properties>
<maven.spotbugsplugin.version>3.1.1</maven.spotbugsplugin.version>
<maven.findbugsplugin.version>3.0.3</maven.findbugsplugin.version>
<lsp4j.version>0.3.0</lsp4j.version>
<apache.commons.io.version>2.6</apache.commons.io.version>
<google.guava.version>21.0</google.guava.version>
Expand Down
Loading

0 comments on commit 89c74f6

Please sign in to comment.