Skip to content

Commit 0d58e20

Browse files
authored
Merge pull request #7 from umjammer/1.4.6
1.4.6
2 parents b89d04d + e522ab7 commit 0d58e20

37 files changed

+479
-443
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,11 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
34-
with:
35-
# We must fetch at least the immediate parents so that if this is
36-
# a pull request then we can checkout the head.
37-
fetch-depth: 2
38-
39-
# If this run was triggered by a pull request event, then checkout
40-
# the head of the pull request instead of the merge commit.
41-
- run: git checkout HEAD
42-
if: ${{ github.event_name == 'pull_request' }}
33+
uses: actions/checkout@v3
4334

4435
# Initializes the CodeQL tools for scanning.
4536
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
37+
uses: github/codeql-action/init@v2
4738
with:
4839
languages: ${{ matrix.language }}
4940
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,15 +43,16 @@ jobs:
5243
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5344

5445
- name: Setup Java JDK
55-
uses: actions/setup-java@v2.3.1
46+
uses: actions/setup-java@v3
5647
with:
57-
java-version: '17.0.1+12'
48+
java-version: '17'
5849
distribution: 'temurin'
50+
cache: maven
5951

6052
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6153
# If this step fails, then you should remove it and run the build manually (see below)
6254
- name: Autobuild
63-
uses: github/codeql-action/autobuild@v1
55+
uses: github/codeql-action/autobuild@v2
6456

6557
# ℹ️ Command-line programs to run using the OS shell.
6658
# 📚 https://git.io/JvXDl
@@ -74,4 +66,4 @@ jobs:
7466
# make release
7567

7668
- name: Perform CodeQL Analysis
77-
uses: github/codeql-action/analyze@v1
69+
uses: github/codeql-action/analyze@v2

.github/workflows/maven.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v1
12-
- name: Set up JDK 17
13-
uses: actions/[email protected]
14-
with:
15-
java-version: '17.0.1+12'
16-
distribution: 'temurin'
17-
- name: Build with Maven
18-
run: mvn -B package --file pom.xml
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Check w/o SNAPSHOT when "bump version"
15+
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
16+
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: maven
24+
25+
- name: Build with Maven
26+
run: mvn -B package --file pom.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
lib/
22
tmp/
33
codavaj-*.jar
4+
java8.properties

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ codavaj.cmd codavaj http://jumpi.sourceforge.net/javadoc/j2se tmp/jumpi/src
3535

3636
## Cooperate with Java Parser
3737

38-
| **parser** | **set javadoc to decompiled source** | **rename argument names as javadoc documented** | **code** |
39-
|:-----------|:------------------------------------:|:-----------------------------------------------:|----------|
40-
| [JavaParser](https://github.com/javaparser/javaparser) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/Test02.java) |
41-
| [rewrite](https://github.com/Netflix-Skunkworks/rewrite) | | 🚧 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/Test03.java) |
42-
| [JDT](https://www.eclipse.org/jdt/) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/Test04.java) |
43-
| [spoon](https://github.com/INRIA/spoon) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/Test05.java) |
38+
| **parser** | **set javadoc to (decompiled) source** | **rename argument names as javadoc documented** | **code** | **output** |
39+
|:-----------|:--------------------------------------:|:-----------------------------------------------:|------------------------------------------------------------------------------------------------------------|:--------------------------------:|
40+
| [JavaParser](https://github.com/javaparser/javaparser) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/commentator/JavaParserCommentator.java) | 👑 |
41+
| [rewrite](https://github.com/Netflix-Skunkworks/rewrite) | jdk version problem? | 🚧 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/commentator/RewriteCommentator.java) | |
42+
| [JDT](https://www.eclipse.org/jdt/) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/commentator/JgtCommentator.java) | little bit worse than JavaParser |
43+
| [spoon](https://github.com/INRIA/spoon) | | 🚫 | [📄](https://github.com/umjammer/codavaj/blob/master/src/test/java/commentator/SpoonCommentator.java) | formats are gone |
4444

4545
## known issues
4646

4747
* codavaj does not introduce default constructor's if they weren't found
4848
in the javadoc. This leads to compile problems if there are subclasses
4949
which use the class's default constructor through the implicit super().
5050

51-
* hekohtml ~1.19.22
51+
* nekohtml ~1.19.22
5252
* https://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtml/1.9.22
5353
* https://mvnrepository.com/artifact/xerces/xercesImpl/2.11.0
5454
* but 1.19.22 doesn't work with this project currently

jitpack.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
jdk:
2+
- openjdk17
3+
before_install:
4+
- sdk install java 17.0.1-open
5+
- sdk use java 17.0.1-open

pom.xml

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>org.codavaj</groupId>
55
<artifactId>codavaj</artifactId>
6-
<version>1.4.5-SNAPSHOT</version>
6+
<version>1.4.6</version>
77

88
<description>
99
TODO
@@ -23,11 +23,10 @@ TODO
2323

2424
<properties>
2525
<!-- for netflix rewrite (default) -->
26-
<java8.home>/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home</java8.home>
26+
<java8.home>/Library/Java/JavaVirtualMachines/jdk1.8.0_341.jdk/Contents/Home</java8.home>
2727
</properties>
2828

2929
<profiles>
30-
3130
<profile>
3231
<id>codavaj</id>
3332
<activation>
@@ -159,6 +158,71 @@ TODO
159158
</dependency>
160159
</dependencies>
161160
</profile>
161+
162+
<profile>
163+
<id>comment</id>
164+
<build>
165+
<plugins>
166+
<plugin>
167+
<groupId>org.apache.maven.plugins</groupId>
168+
<artifactId>maven-antrun-plugin</artifactId>
169+
<version>3.1.0</version>
170+
<executions>
171+
<execution>
172+
<id>spoon</id>
173+
<goals>
174+
<goal>run</goal>
175+
</goals>
176+
<configuration>
177+
<target>
178+
<java classname="commentator.SpoonCommentator" fork="true">
179+
<classpath>
180+
<path refid="maven.compile.classpath"/>
181+
<path refid="maven.test.classpath"/>
182+
</classpath>
183+
<jvmarg value="-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties" />
184+
<jvmarg line="--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" />
185+
<jvmarg line="--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" />
186+
<jvmarg line="--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" />
187+
<jvmarg line="--add-exports jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" />
188+
<jvmarg line="--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" />
189+
<arg value="${user.home}/src/java/jsapi/tmp/javadoc" /> <!-- javadocDir -->
190+
<arg value="https://docs.oracle.com/javase/jp/8/docs/api/" /> <!-- externalLink -->
191+
<arg value="${user.home}/src/java/jsapi/src/main/java" /> <!-- sourceDir -->
192+
<arg value="${user.home}/src/java/jsapi/tmp/src" /> <!-- outputDir -->
193+
<arg value="javax\.speech" /> <!-- packageFilter -->
194+
</java>
195+
</target>
196+
</configuration>
197+
</execution>
198+
<execution>
199+
<id>javaParser</id>
200+
<goals>
201+
<goal>run</goal>
202+
</goals>
203+
<configuration>
204+
<target>
205+
<java classname="commentator.JavaParserCommentator" fork="true">
206+
<classpath>
207+
<path refid="maven.compile.classpath"/>
208+
<path refid="maven.test.classpath"/>
209+
</classpath>
210+
<jvmarg value="-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties" />
211+
<arg value="${user.home}/src/java/jsapi/tmp/javadoc" /> <!-- javadocDir -->
212+
<arg value="https://docs.oracle.com/javase/jp/8/docs/api/" /> <!-- externalLink -->
213+
<arg value="${user.home}/src/java/jsapi/src/main/java" /> <!-- sourceDir -->
214+
<arg value="${user.home}/src/java/jsapi/tmp/src" /> <!-- outputDir -->
215+
<arg value="javax\.speech" /> <!-- packageFilter -->
216+
</java>
217+
</target>
218+
</configuration>
219+
</execution>
220+
</executions>
221+
</plugin>
222+
</plugins>
223+
</build>
224+
</profile>
225+
162226
</profiles>
163227

164228
<build>
@@ -232,7 +296,7 @@ TODO
232296
<dependency>
233297
<groupId>org.junit</groupId>
234298
<artifactId>junit-bom</artifactId>
235-
<version>5.8.2</version>
299+
<version>5.9.1</version>
236300
<type>pom</type>
237301
<scope>import</scope>
238302
</dependency>
@@ -298,7 +362,7 @@ TODO
298362
<dependency>
299363
<groupId>com.github.umjammer</groupId>
300364
<artifactId>vavi-commons</artifactId>
301-
<version>1.1.6</version>
365+
<version>1.1.8</version>
302366
</dependency>
303367

304368
<dependency>
@@ -320,7 +384,7 @@ TODO
320384
<dependency>
321385
<groupId>com.github.javaparser</groupId>
322386
<artifactId>javaparser-symbol-solver-core</artifactId>
323-
<version>3.24.4</version>
387+
<version>3.24.7</version>
324388
<scope>test</scope>
325389
</dependency>
326390

@@ -334,6 +398,10 @@ TODO
334398
<groupId>com.fasterxml.jackson.core</groupId>
335399
<artifactId>jackson-annotations</artifactId>
336400
</exclusion>
401+
<exclusion>
402+
<groupId>org.slf4j</groupId>
403+
<artifactId>slf4j-api</artifactId>
404+
</exclusion>
337405
</exclusions>
338406
</dependency>
339407
<dependency>
@@ -353,7 +421,7 @@ TODO
353421
<dependency>
354422
<groupId>fr.inria.gforge.spoon</groupId>
355423
<artifactId>spoon-core</artifactId>
356-
<version>10.1.1</version>
424+
<version>10.2.0</version>
357425
<scope>test</scope>
358426
</dependency>
359427
</dependencies>

retrieve.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
3+
mv pom.xml pom.xml.orig
4+
sed -e '[email protected].*[email protected]>'$JAVA_HOME'</java8.home@' pom.xml.orig > pom.xml || mv pom.xml.orig pom.xml
5+
diff pom.xml.orig pom.xml
6+
if [ $? -eq 0 ]; then # no diff
7+
rm pom.xml.orig
8+
fi
9+
echo "java8.home=$JAVA_HOME" > java8.properties

src/main/java/org/codavaj/Main.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.codavaj;
1818

1919
import java.util.ArrayList;
20+
import java.util.Arrays;
2021
import java.util.List;
2122
import java.util.logging.Logger;
2223

@@ -25,6 +26,7 @@
2526
import org.codavaj.process.wget.Wget;
2627
import org.codavaj.type.TypeFactory;
2728

29+
2830
/**
2931
* The program entry point.
3032
* <p>
@@ -46,13 +48,12 @@ public class Main {
4648
* to external javadoc links. External links to Sun's JDK javadoc apis are
4749
* automatically resolved ( i.e. http://java.sun.com/j2se/X/docs/api/ )
4850
*
49-
* @param javadocdir the javadoc tree root
51+
* @param javadocdir the javadoc tree root
5052
* @param externalLinks a list of 'http://..' strings representing external javadoc refs.
51-
*
5253
* @return a TypeFactory handle on the resulting api
5354
* @throws ProcessException any problem.
5455
*/
55-
public static TypeFactory analyze( String javadocdir, List<String> externalLinks ) throws ProcessException {
56+
public static TypeFactory analyze(String javadocdir, List<String> externalLinks) throws ProcessException {
5657

5758
DocParser dp = new DocParser();
5859
dp.setJavadocDirName(javadocdir);
@@ -67,12 +68,12 @@ public static TypeFactory analyze( String javadocdir, List<String> externalLinks
6768
* <p>
6869
* command is "wget" or "codavaj".
6970
* </p>
71+
*
7072
* @param args 0: command, 1: source url, 2: output dir, [3: encoding], [4: language]
7173
*/
7274
public static void main(String[] args) throws Exception {
7375
if (args.length < 3) {
74-
System.err.println("usage alternatives: \n\t" + usage_wget + "\n\t"
75-
+ usage_parse);
76+
System.err.println("usage alternatives: \n\t" + usage_wget + "\n\t" + usage_parse);
7677

7778
return;
7879
}
@@ -85,21 +86,18 @@ public static void main(String[] args) throws Exception {
8586
// "exec-maven-plugin" doesn't have "fork" option.
8687
// usually, use a jvmarg like "-Dcodavaj.file.encoding=MS932"
8788
System.setProperty("codavaj.file.encoding", args[3]);
88-
logger.info("encoding: " + System.getProperty("codavaj.file.encoding"));
89+
logger.info("encoding: " + System.getProperty("codavaj.file.encoding"));
8990
}
9091
if (args.length > 4) {
9192
// reluctantly, cause "exec-maven-plugin" cannot pass system properties as jvm arguments.
9293
// "exec-maven-plugin" doesn't have "fork" option.
9394
// usually, use a jvmarg like "-Dcodavaj.language=JAPANESE"
9495
System.setProperty("codavaj.language", args[4]);
95-
logger.info("language: " + System.getProperty("codavaj.language"));
96+
logger.info("language: " + System.getProperty("codavaj.language"));
9697
}
9798

9899
// all subsequent arguments become external javadoc URL references
99-
List<String> externalLinks = new ArrayList<>();
100-
for( int i = 3; i < args.length; i++) {
101-
externalLinks.add(args[i]);
102-
}
100+
List<String> externalLinks = new ArrayList<>(Arrays.asList(args).subList(3, args.length));
103101

104102
if ("wget".equals(cmd)) {
105103
Wget wget = new Wget();
@@ -121,10 +119,7 @@ public static void main(String[] args) throws Exception {
121119
sw.addProgressListener(System.err::println);
122120
sw.process();
123121
} else {
124-
System.err.println("usage alternatives: \n\t" + usage_wget + "\n\t"
125-
+ usage_parse);
126-
127-
return;
122+
System.err.println("usage alternatives: \n\t" + usage_wget + "\n\t" + usage_parse);
128123
}
129124
}
130125
}

src/main/java/org/codavaj/MissingParameterException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616

1717
package org.codavaj;
1818

19+
import java.io.Serial;
20+
21+
1922
/**
2023
* DOCUMENT ME!
2124
*/
2225
public class MissingParameterException extends ProcessException {
26+
@Serial
2327
private static final long serialVersionUID = -7654967901729855056L;
2428

2529
/**

src/main/java/org/codavaj/ProcessException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616

1717
package org.codavaj;
1818

19+
import java.io.Serial;
20+
21+
1922
/**
2023
* DOCUMENT ME!
2124
*/
2225
public class ProcessException extends Exception {
26+
@Serial
2327
private static final long serialVersionUID = 2949538686794102085L;
2428

2529
/**

0 commit comments

Comments
 (0)