Skip to content

Commit

Permalink
code cleanup in wscompile
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Oct 16, 2023
1 parent 5581649 commit a9b2d60
Show file tree
Hide file tree
Showing 88 changed files with 988 additions and 1,085 deletions.
3 changes: 2 additions & 1 deletion jaxws-ri/bundles/jaxws-tools/src/main/java/module-info.java
Expand Up @@ -16,6 +16,7 @@
*
* @since 2.4.0
*/
@SuppressWarnings({"deprecation"})
module com.sun.tools.ws {

requires transitive java.compiler;
Expand All @@ -24,7 +25,7 @@

requires transitive com.sun.xml.ws;

requires com.sun.tools.jxc;
requires transitive com.sun.tools.jxc;
requires transitive com.sun.tools.xjc;

exports com.sun.tools.ws;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -125,8 +125,8 @@ static int invoke(String mainClass, String[] args) throws Throwable {

Thread.currentThread().setContextClassLoader(cl);

Class compileTool = cl.loadClass(mainClass);
Constructor ctor = compileTool.getConstructor(OutputStream.class);
Class<?> compileTool = cl.loadClass(mainClass);
Constructor<?> ctor = compileTool.getConstructor(OutputStream.class);
Object tool = ctor.newInstance(System.out);
Method runMethod = compileTool.getMethod("run",String[].class);
boolean r = (Boolean)runMethod.invoke(tool,new Object[]{args});
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -39,6 +39,7 @@
/**
* annotation processing task for use with the JAXWS project.
*/
@SuppressWarnings({"exports"})
public class AnnotationProcessingTask extends Javac {

private boolean procOnly = false;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -41,6 +41,7 @@ protected String getCoreClassName() {


@Override
@SuppressWarnings({"exports"})
public void setDynamicAttribute(String name, String value) throws BuildException {
super.setDynamicAttribute(name,value);
if(name.equals("target"))
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -80,7 +80,7 @@ public void setClasspathRef(Reference r) {
createClasspath().setRefid(r);
}

/************************ -cp option *************************/
/* *********************** -cp option *************************/
/**
* Gets the classpath.
*
Expand Down Expand Up @@ -272,7 +272,7 @@ public void setSei(String endpointImplementationClass) {
protected CommandlineJava setupCommand() {
CommandlineJava cmd = super.setupCommand();
Path classpath = getClasspath();
if (classpath != null && !classpath.toString().equals("")) {
if (classpath != null && !classpath.toString().isEmpty()) {
cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(classpath);
}
Expand All @@ -284,17 +284,17 @@ protected CommandlineJava setupCommand() {

if (getGenwsdl()) {
String tmp = "-wsdl";
if (protocol.length() > 0) {
if (!protocol.isEmpty()) {
tmp += ":" + protocol;
}
cmd.createArgument().setValue(tmp);

if (serviceName != null && serviceName.length() > 0) {
if (serviceName != null && !serviceName.isEmpty()) {
cmd.createArgument().setValue("-servicename");
cmd.createArgument().setValue(serviceName);
}

if (portName != null && portName.length() > 0) {
if (portName != null && !portName.isEmpty()) {
cmd.createArgument().setValue("-portname");
cmd.createArgument().setValue(portName);
}
Expand All @@ -307,7 +307,7 @@ protected CommandlineJava setupCommand() {
}

// r option
if (null != getResourcedestdir() && !getResourcedestdir().getName().equals("")) {
if (null != getResourcedestdir() && !getResourcedestdir().getName().isEmpty()) {
cmd.createArgument().setValue("-r");
cmd.createArgument().setFile(getResourcedestdir());
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -32,6 +32,7 @@
*
* @author lukas
*/
@SuppressWarnings({"exports"})
public class WsImportBase extends WsTask2 {

/**
Expand Down Expand Up @@ -430,7 +431,7 @@ protected CommandlineJava setupCommand() {
}

//catalog
if((getCatalog() != null) && (getCatalog().getName().length() > 0)){
if((getCatalog() != null) && (!getCatalog().getName().isEmpty())){
cmd.createArgument().setValue("-catalog");
cmd.createArgument().setFile(getCatalog());
}
Expand Down Expand Up @@ -459,7 +460,7 @@ protected CommandlineJava setupCommand() {
}

//package
if((getPackage() != null) && (getPackage().length() > 0)){
if((getPackage() != null) && (!getPackage().isEmpty())){
cmd.createArgument().setValue("-p");
cmd.createArgument().setValue(getPackage());
}
Expand Down Expand Up @@ -505,7 +506,7 @@ protected CommandlineJava setupCommand() {
}
}

if((wsdlLocation != null) && (wsdlLocation.length() != 0)){
if((wsdlLocation != null) && (!wsdlLocation.isEmpty())){
cmd.createArgument().setValue("-wsdllocation");
cmd.createArgument().setValue(wsdlLocation);
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -500,7 +500,7 @@ protected final void execute(String tool, String toolClass) throws BuildExceptio
*/
protected CommandlineJava setupCommand() {
// d option
if (null != getDestdir() && !getDestdir().getName().equals("")) {
if (null != getDestdir() && !getDestdir().getName().isEmpty()) {
getCommandline().createArgument().setValue("-d");
getCommandline().createArgument().setFile(getDestdir());
}
Expand All @@ -517,7 +517,7 @@ protected CommandlineJava setupCommand() {
getCommandline().createArgument().setValue("-keep");
}
// s option
if (null != getSourcedestdir() && !getSourcedestdir().getName().equals("")) {
if (null != getSourcedestdir() && !getSourcedestdir().getName().isEmpty()) {
getCommandline().createArgument().setValue("-s");
getCommandline().createArgument().setFile(getSourcedestdir());
}
Expand Down Expand Up @@ -582,29 +582,29 @@ public void setupForkCommand(String className) {
cp.append(mvn);
}

if (getModulepath() != null && getModulepath().size() > 0) {
if (getModulepath() != null && !getModulepath().isEmpty()) {
getCommandline().createModulepath(getProject()).add(getModulepath());
}

if (getUpgrademodulepath() != null && getUpgrademodulepath().size() > 0) {
if (getUpgrademodulepath() != null && !getUpgrademodulepath().isEmpty()) {
getCommandline().createUpgrademodulepath(getProject()).add(getUpgrademodulepath());
}
if (getAddmodules() != null && getAddmodules().length() > 0) {
if (getAddmodules() != null && !getAddmodules().isEmpty()) {
getCommandline().createVmArgument().setLine("--add-modules " + getAddmodules());
}
if (getAddreads() != null && getAddreads().length() > 0) {
if (getAddreads() != null && !getAddreads().isEmpty()) {
getCommandline().createVmArgument().setLine("--add-reads " + getAddreads());
}
if (getAddexports() != null && getAddexports().length() > 0) {
if (getAddexports() != null && !getAddexports().isEmpty()) {
getCommandline().createVmArgument().setLine("--add-exports " + getAddexports());
}
if (getAddopens() != null && getAddopens().length() > 0) {
if (getAddopens() != null && !getAddopens().isEmpty()) {
getCommandline().createVmArgument().setLine("--add-opens " + getAddopens());
}
if (getPatchmodule() != null && getPatchmodule().length() > 0) {
if (getPatchmodule() != null && !getPatchmodule().isEmpty()) {
getCommandline().createVmArgument().setLine("--patch-module " + getPatchmodule());
}
if (getLimitmodules() != null && getLimitmodules().length() > 0) {
if (getLimitmodules() != null && !getLimitmodules().isEmpty()) {
getCommandline().createVmArgument().setLine("--limit-modules " + getLimitmodules());
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand All @@ -17,7 +17,7 @@
* {@link WsgenExtension}s through the
* {@code META-INF/services/com.sun.tools.internal.ws.api.WsgenExtension}
* files.
*
* <p>
* {@link WsgenProtocol} annotation can be specified on the
* extensions to extend -wsdl[:protocol] behaviour.
*
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand All @@ -11,7 +11,7 @@
/**
* <h2>JAX-WS 2.1 Tools</h2>
* This document describes the tools included with JAX-WS 2.0.1.
*
* <p>
* <h2>ANT Tasks</h2>
<dl>
* <dt>{@link com.sun.tools.ws.ant.AnnotationProcessingTask AnnotationProcessing}</dt>
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -67,7 +67,7 @@ public void visit(Fault fault) throws Exception {
}

private boolean isRegistered(Fault fault) {
if(faults.keySet().contains(fault.getJavaException().getName())){
if(faults.containsKey(fault.getJavaException().getName())){
fault.setExceptionClass(faults.get(fault.getJavaException().getName()));
return true;
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -108,13 +108,11 @@ public void visit(Operation operation) throws Exception {
if (operation.getResponse() != null) {
operation.getResponse().accept(this);
}
Iterator faults = operation.getFaultsSet().iterator();
if (faults != null) {
Fault fault;
while (faults.hasNext()) {
fault = (Fault) faults.next();
fault.accept(this);
}
Iterator<Fault> faults = operation.getFaultsSet().iterator();
Fault fault;
while (faults.hasNext()) {
fault = faults.next();
fault.accept(this);
}
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -31,9 +31,9 @@ public enum GeneratorConstants {

FAULT_CLASS_MEMBER_NAME("faultInfo");

private String value;
private final String value;

private GeneratorConstants(String value) {
GeneratorConstants(String value) {
this.value = value;
}

Expand Down

0 comments on commit a9b2d60

Please sign in to comment.