Skip to content

Commit

Permalink
use google-java-format to format Java files (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-hunhoff authored Apr 25, 2023
1 parent 939952c commit 47e343f
Show file tree
Hide file tree
Showing 8 changed files with 1,056 additions and 1,102 deletions.
56 changes: 28 additions & 28 deletions src/main/java/ghidrathon/GhidrathonClassEnquirer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,48 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: [package root]/LICENSE.txt
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied.
// See the License for the specific language governing permissions and limitations under the
// License.

package ghidrathon;

import java.util.List;
import java.util.ArrayList;

import jep.ClassList;
import java.util.List;
import jep.ClassEnquirer;
import jep.ClassList;

/**
* Implements Jep ClassEnquirer used to handle Java imports from Python - specifically we
* use this class to handle naming conflicts, e.g. pdb
* Implements Jep ClassEnquirer used to handle Java imports from Python - specifically we use this
* class to handle naming conflicts, e.g. pdb
*/
public class GhidrathonClassEnquirer implements ClassEnquirer {

private final List<String> javaExcludeLibs = new ArrayList<String>();
private final ClassEnquirer classList = ClassList.getInstance();

public void addJavaExcludeLib(String name) {
javaExcludeLibs.add(name);
}
private final List<String> javaExcludeLibs = new ArrayList<String>();
private final ClassEnquirer classList = ClassList.getInstance();

public void addJavaExcludeLibs(List<String> names) {
javaExcludeLibs.addAll(names);
}
public void addJavaExcludeLib(String name) {
javaExcludeLibs.add(name);
}

public boolean isJavaPackage(String name) {
if (javaExcludeLibs.contains(name)) {
return false;
}
public void addJavaExcludeLibs(List<String> names) {
javaExcludeLibs.addAll(names);
}

return classList.isJavaPackage(name);
}
public boolean isJavaPackage(String name) {
if (javaExcludeLibs.contains(name)) {
return false;
}

public String[] getClassNames(String name) {
return classList.getClassNames(name);
}
return classList.isJavaPackage(name);
}

public String[] getSubPackages(String name) {
return classList.getSubPackages(name);
}
public String[] getClassNames(String name) {
return classList.getClassNames(name);
}

public String[] getSubPackages(String name) {
return classList.getSubPackages(name);
}
}
104 changes: 52 additions & 52 deletions src/main/java/ghidrathon/GhidrathonConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,83 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: [package root]/LICENSE.txt
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied.
// See the License for the specific language governing permissions and limitations under the
// License.

package ghidrathon;

import java.util.List;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Ghidrathon's configuration class
*
* Stores
* - stdout and stderr
* - Python modules to handle as shared modules - relevant to CPython modules
* - Java package names to exclude from Python imports
* - Python include paths to add to Python interpreter environment
* <p>Stores - stdout and stderr - Python modules to handle as shared modules - relevant to CPython
* modules - Java package names to exclude from Python imports - Python include paths to add to
* Python interpreter environment
*/
public class GhidrathonConfig {

private final List<String> javaExcludeLibs = new ArrayList<String>();
private final List<String> pyIncludePaths = new ArrayList<String>();
private final List<String> pySharedModules = new ArrayList<String>();
private final List<String> javaExcludeLibs = new ArrayList<String>();
private final List<String> pyIncludePaths = new ArrayList<String>();
private final List<String> pySharedModules = new ArrayList<String>();

private PrintWriter out = null;
private PrintWriter err = null;
private PrintWriter out = null;
private PrintWriter err = null;

public void addStdOut(PrintWriter out) {
this.out = out;
}
public void addStdOut(PrintWriter out) {
this.out = out;
}

public void addStdErr(PrintWriter err) {
this.err = err;
}
public void addStdErr(PrintWriter err) {
this.err = err;
}

public PrintWriter getStdOut() {
return out;
}
public PrintWriter getStdOut() {
return out;
}

public PrintWriter getStdErr() {
return err;
}
public PrintWriter getStdErr() {
return err;
}

public void addPythonSharedModule(String name) {
pySharedModules.add(name);
}
public void addPythonSharedModule(String name) {
pySharedModules.add(name);
}

public void addPythonSharedModules(List<String> names) {
pySharedModules.addAll(names);
}
public void addPythonSharedModules(List<String> names) {
pySharedModules.addAll(names);
}

public Iterable<String> getPythonSharedModules() {
return Collections.unmodifiableList(pySharedModules);
}
public Iterable<String> getPythonSharedModules() {
return Collections.unmodifiableList(pySharedModules);
}

public void addJavaExcludeLib(String name) {
javaExcludeLibs.add(name);
}
public void addJavaExcludeLib(String name) {
javaExcludeLibs.add(name);
}

public void addJavaExcludeLibs(List<String> names) {
javaExcludeLibs.addAll(names);
}
public void addJavaExcludeLibs(List<String> names) {
javaExcludeLibs.addAll(names);
}

public Iterable<String> getJavaExcludeLibs() {
return Collections.unmodifiableList(javaExcludeLibs);
}
public Iterable<String> getJavaExcludeLibs() {
return Collections.unmodifiableList(javaExcludeLibs);
}

public void addPythonIncludePath(String path) {
pyIncludePaths.add(path);
}
public void addPythonIncludePath(String path) {
pyIncludePaths.add(path);
}

public void addPythonIncludePaths(List<String> paths) {
pyIncludePaths.addAll(paths);
}
public void addPythonIncludePaths(List<String> paths) {
pyIncludePaths.addAll(paths);
}

public Iterable<String> getPythonIncludePaths() {
return Collections.unmodifiableList(pyIncludePaths);
}
public Iterable<String> getPythonIncludePaths() {
return Collections.unmodifiableList(pyIncludePaths);
}
}
Loading

0 comments on commit 47e343f

Please sign in to comment.