Skip to content

Commit 7a829b5

Browse files
committed
Merge branch 'master' of github.com:eclipse-ee4j/jaxb-ri into 1603
2 parents 53a80f1 + acaa854 commit 7a829b5

File tree

88 files changed

+1422
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1422
-560
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '17 23 * * 0'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'java' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
54+
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66+
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
70+
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v2

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
- name: Verify
3636
run: |
3737
cd jaxb-ri
38-
mvn -B -V -U -C -Pstaging,oss-release clean verify org.glassfish.copyright:glassfish-copyright-maven-plugin:check -Dgpg.skip=true -Doss.disallow.snapshots=false -Dcopyright.ignoreyear=true
38+
mvn -B -V -U -C -Pstaging,oss-release,dependency-check clean verify org.glassfish.copyright:glassfish-copyright-maven-plugin:check -Dgpg.skip=true -Doss.disallow.snapshots=false -Dcopyright.ignoreyear=true

jaxb-ri/boms/bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
<plugin>
259259
<groupId>org.apache.maven.plugins</groupId>
260260
<artifactId>maven-javadoc-plugin</artifactId>
261-
<version>3.3.2</version>
261+
<version>3.4.0</version>
262262
</plugin>
263263
<plugin>
264264
<groupId>org.apache.maven.plugins</groupId>

jaxb-ri/bundles/core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
<configuration>
249249
<skip>false</skip>
250250
<systemProperties>
251-
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
251+
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
252252
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
253253
</systemProperties>
254254
</configuration>

jaxb-ri/bundles/jxc/pom.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -272,9 +272,12 @@
272272
<phase>integration-test</phase>
273273
<configuration>
274274
<systemProperties>
275-
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
275+
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
276276
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
277277
</systemProperties>
278+
<classpathDependencyExcludes>
279+
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
280+
</classpathDependencyExcludes>
278281
</configuration>
279282
</execution>
280283
</executions>

jaxb-ri/bundles/osgi/osgi/pom.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,23 @@
306306
<plugin>
307307
<groupId>org.apache.maven.plugins</groupId>
308308
<artifactId>maven-surefire-plugin</artifactId>
309-
<configuration>
310-
<skip>true</skip>
311-
</configuration>
312309
<executions>
313310
<execution>
314-
<id>integration-test</id>
315-
<goals>
316-
<goal>test</goal>
317-
</goals>
311+
<id>default-test</id>
318312
<phase>integration-test</phase>
319313
<configuration>
320-
<skip>false</skip>
321-
<systemProperties>
322-
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
314+
<systemPropertyVariables>
315+
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
323316
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
324-
</systemProperties>
317+
</systemPropertyVariables>
318+
<classpathDependencyExcludes>
319+
<classpathDependencyExclude>com.sun.istack:*</classpathDependencyExclude>
320+
<classpathDependencyExclude>com.sun.xml.bind.external:*</classpathDependencyExclude>
321+
<classpathDependencyExclude>com.sun.xml.dtd-parser:*</classpathDependencyExclude>
322+
<classpathDependencyExclude>com.sun.xml.fastinfoset:*</classpathDependencyExclude>
323+
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
324+
<classpathDependencyExclude>org.jvnet.staxex:*</classpathDependencyExclude>
325+
</classpathDependencyExcludes>
325326
</configuration>
326327
</execution>
327328
</executions>

jaxb-ri/bundles/ri/src/main/resources/bin/schemagend.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ else
6363
JAVA=java
6464
fi
6565

66-
DEBUG_OPTS="-J-Djava.compiler=NONE -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000'"
66+
DEBUG_OPTS="-Djava.compiler=NONE -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
6767

6868
if [ `expr \`uname\` : 'CYGWIN'` -eq 6 ]
6969
then

jaxb-ri/bundles/runtime/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@
248248
<phase>integration-test</phase>
249249
<configuration>
250250
<systemPropertyVariables>
251-
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
251+
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
252252
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
253253
</systemPropertyVariables>
254+
<classpathDependencyExcludes>
255+
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
256+
</classpathDependencyExcludes>
254257
</configuration>
255258
</execution>
256259
</executions>

jaxb-ri/bundles/xjc/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,18 +325,18 @@
325325
<plugin>
326326
<groupId>org.apache.maven.plugins</groupId>
327327
<artifactId>maven-surefire-plugin</artifactId>
328-
<configuration>
329-
<skip>true</skip>
330-
</configuration>
331328
<executions>
332329
<execution>
333330
<id>default-test</id>
334331
<phase>integration-test</phase>
335332
<configuration>
336333
<systemProperties>
337-
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
334+
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
338335
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
339336
</systemProperties>
337+
<classpathDependencyExcludes>
338+
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
339+
</classpathDependencyExcludes>
340340
</configuration>
341341
</execution>
342342
</executions>

jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JInvocation.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ public void generate(JFormatter f) {
140140
// [RESULT] new T[]{arg1,arg2,arg3,...};
141141
f.p("new").g(type).p('{');
142142
} else {
143-
if (isConstructor)
144-
f.p("new").g(type).p('(');
145-
else {
143+
if (isConstructor) {
144+
if (type instanceof JNarrowedClass) {
145+
JNarrowedClass jc = (JNarrowedClass) type;
146+
f.p("new").t(jc.basis).p('<').p(JFormatter.CLOSE_TYPE_ARGS).p('(');
147+
148+
} else {
149+
f.p("new").g(type).p('(');
150+
}
151+
} else {
146152
String name = this.name;
147153
if(name==null) name=this.method.name();
148154

jaxb-ri/codemodel/codemodel/src/test/java/com/sun/codemodel/tests/ForEachTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Distribution License v. 1.0, which is available at
@@ -10,8 +10,11 @@
1010

1111
package com.sun.codemodel.tests;
1212

13+
import java.io.ByteArrayOutputStream;
14+
import java.nio.charset.StandardCharsets;
1315
import java.util.ArrayList;
1416

17+
import org.junit.Assert;
1518
import org.junit.Test;
1619

1720
import com.sun.codemodel.JClass;
@@ -44,9 +47,7 @@ public void main() throws Exception {
4447
JMethod m = cls.method(JMod.PUBLIC, cm.VOID, "foo");
4548
m.body().decl(cm.INT, "getCount");
4649

47-
// This is not exactly right because we need to
48-
// support generics
49-
JClass arrayListclass = cm.ref(ArrayList.class);
50+
JClass arrayListclass = cm.ref(ArrayList.class).narrow(Integer.class);
5051
JVar $list = m.body().decl(arrayListclass, "alist",
5152
JExpr._new(arrayListclass));
5253

@@ -60,6 +61,10 @@ public void main() throws Exception {
6061
// JInvocation invocation =
6162
foreach.body().invoke(out1, "println").arg($count1);
6263

63-
cm.build(new SingleStreamCodeWriter(System.out));
64+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
65+
cm.build(new SingleStreamCodeWriter(baos));
66+
String result = baos.toString(StandardCharsets.UTF_8);
67+
System.out.println(result);
68+
Assert.assertTrue(result.contains("ArrayList<Integer> alist = new ArrayList<>();"));
6469
}
6570
}

jaxb-ri/codemodel/pom.xml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<spotbugs.skip>false</spotbugs.skip>
6464
<spotbugs.threshold>High</spotbugs.threshold>
6565
<spotbugs.version>4.6.0.0</spotbugs.version>
66+
<findsecbugs.version>1.11.0</findsecbugs.version>
6667

6768
<maven.compiler.release>11</maven.compiler.release>
6869
<maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
@@ -96,12 +97,12 @@
9697
<plugin>
9798
<groupId>org.codehaus.mojo</groupId>
9899
<artifactId>buildnumber-maven-plugin</artifactId>
99-
<version>1.4</version>
100+
<version>3.0.0</version>
100101
</plugin>
101102
<plugin>
102103
<groupId>org.codehaus.mojo</groupId>
103104
<artifactId>build-helper-maven-plugin</artifactId>
104-
<version>3.2.0</version>
105+
<version>3.3.0</version>
105106
</plugin>
106107
<plugin>
107108
<groupId>org.apache.felix</groupId>
@@ -116,7 +117,7 @@
116117
<plugin>
117118
<groupId>org.apache.maven.plugins</groupId>
118119
<artifactId>maven-jar-plugin</artifactId>
119-
<version>3.2.0</version>
120+
<version>3.2.2</version>
120121
</plugin>
121122
<plugin>
122123
<groupId>org.apache.maven.plugins</groupId>
@@ -126,7 +127,7 @@
126127
<plugin>
127128
<groupId>org.apache.maven.plugins</groupId>
128129
<artifactId>maven-javadoc-plugin</artifactId>
129-
<version>3.3.2</version>
130+
<version>3.4.0</version>
130131
<configuration>
131132
<archive>
132133
<manifest>
@@ -143,6 +144,11 @@
143144
<artifactId>maven-compiler-plugin</artifactId>
144145
<version>3.10.1</version>
145146
</plugin>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-surefire-plugin</artifactId>
150+
<version>3.0.0-M6</version>
151+
</plugin>
146152
<plugin>
147153
<groupId>org.apache.maven.plugins</groupId>
148154
<artifactId>maven-assembly-plugin</artifactId>
@@ -179,7 +185,26 @@
179185
<excludeFilterFile>
180186
${spotbugs.exclude}
181187
</excludeFilterFile>
182-
<fork>true</fork>
188+
<plugins>
189+
<plugin>
190+
<groupId>com.h3xstream.findsecbugs</groupId>
191+
<artifactId>findsecbugs-plugin</artifactId>
192+
<version>${findsecbugs.version}</version>
193+
</plugin>
194+
</plugins>
195+
</configuration>
196+
</plugin>
197+
<plugin>
198+
<groupId>org.owasp</groupId>
199+
<artifactId>dependency-check-maven</artifactId>
200+
<version>7.1.0</version>
201+
<configuration>
202+
<failBuildOnCVSS>7</failBuildOnCVSS>
203+
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
204+
<formats>
205+
<format>HTML</format>
206+
<format>CSV</format>
207+
</formats>
183208
</configuration>
184209
</plugin>
185210
</plugins>
@@ -388,4 +413,43 @@
388413
</plugins>
389414
</build>
390415

416+
<profiles>
417+
<profile>
418+
<id>spotbugs</id>
419+
<build>
420+
<plugins>
421+
<plugin>
422+
<groupId>com.github.spotbugs</groupId>
423+
<artifactId>spotbugs-maven-plugin</artifactId>
424+
<executions>
425+
<execution>
426+
<phase>verify</phase>
427+
<goals>
428+
<goal>spotbugs</goal>
429+
</goals>
430+
</execution>
431+
</executions>
432+
</plugin>
433+
</plugins>
434+
</build>
435+
</profile>
436+
<profile>
437+
<id>dependency-check</id>
438+
<build>
439+
<plugins>
440+
<plugin>
441+
<groupId>org.owasp</groupId>
442+
<artifactId>dependency-check-maven</artifactId>
443+
<executions>
444+
<execution>
445+
<goals>
446+
<goal>check</goal>
447+
</goals>
448+
</execution>
449+
</executions>
450+
</plugin>
451+
</plugins>
452+
</build>
453+
</profile>
454+
</profiles>
391455
</project>

0 commit comments

Comments
 (0)