Skip to content

Commit

Permalink
Merge branch 'master' of github.com:eclipse-ee4j/jaxb-ri into 1603
Browse files Browse the repository at this point in the history
  • Loading branch information
gorky committed Jun 18, 2022
2 parents 53a80f1 + acaa854 commit 7a829b5
Show file tree
Hide file tree
Showing 88 changed files with 1,422 additions and 560 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '17 23 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# 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
# queries: security-extended,security-and-quality


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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
- name: Verify
run: |
cd jaxb-ri
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
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
2 changes: 1 addition & 1 deletion jaxb-ri/boms/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion jaxb-ri/bundles/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
<configuration>
<skip>false</skip>
<systemProperties>
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
</systemProperties>
</configuration>
Expand Down
7 changes: 5 additions & 2 deletions jaxb-ri/bundles/jxc/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2022 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 @@ -272,9 +272,12 @@
<phase>integration-test</phase>
<configuration>
<systemProperties>
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
</systemProperties>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
Expand Down
23 changes: 12 additions & 11 deletions jaxb-ri/bundles/osgi/osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,22 +306,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>test</goal>
</goals>
<id>default-test</id>
<phase>integration-test</phase>
<configuration>
<skip>false</skip>
<systemProperties>
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
<systemPropertyVariables>
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
</systemProperties>
</systemPropertyVariables>
<classpathDependencyExcludes>
<classpathDependencyExclude>com.sun.istack:*</classpathDependencyExclude>
<classpathDependencyExclude>com.sun.xml.bind.external:*</classpathDependencyExclude>
<classpathDependencyExclude>com.sun.xml.dtd-parser:*</classpathDependencyExclude>
<classpathDependencyExclude>com.sun.xml.fastinfoset:*</classpathDependencyExclude>
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
<classpathDependencyExclude>org.jvnet.staxex:*</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion jaxb-ri/bundles/ri/src/main/resources/bin/schemagend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else
JAVA=java
fi

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

if [ `expr \`uname\` : 'CYGWIN'` -eq 6 ]
then
Expand Down
5 changes: 4 additions & 1 deletion jaxb-ri/bundles/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,12 @@
<phase>integration-test</phase>
<configuration>
<systemPropertyVariables>
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
</systemPropertyVariables>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
Expand Down
8 changes: 4 additions & 4 deletions jaxb-ri/bundles/xjc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>default-test</id>
<phase>integration-test</phase>
<configuration>
<systemProperties>
<jaxb.spec.version>${jaxb-api.version}</jaxb.spec.version>
<jaxb.spec.version>${xml.bind-api.version}</jaxb.spec.version>
<osgi.dist>${project.build.directory}/${project.build.finalName}</osgi.dist>
</systemProperties>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.glassfish.jaxb:*</classpathDependencyExclude>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,15 @@ public void generate(JFormatter f) {
// [RESULT] new T[]{arg1,arg2,arg3,...};
f.p("new").g(type).p('{');
} else {
if (isConstructor)
f.p("new").g(type).p('(');
else {
if (isConstructor) {
if (type instanceof JNarrowedClass) {
JNarrowedClass jc = (JNarrowedClass) type;
f.p("new").t(jc.basis).p('<').p(JFormatter.CLOSE_TYPE_ARGS).p('(');

} else {
f.p("new").g(type).p('(');
}
} else {
String name = this.name;
if(name==null) name=this.method.name();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022 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 @@ -10,8 +10,11 @@

package com.sun.codemodel.tests;

import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

import org.junit.Assert;
import org.junit.Test;

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

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

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

cm.build(new SingleStreamCodeWriter(System.out));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
cm.build(new SingleStreamCodeWriter(baos));
String result = baos.toString(StandardCharsets.UTF_8);
System.out.println(result);
Assert.assertTrue(result.contains("ArrayList<Integer> alist = new ArrayList<>();"));
}
}
74 changes: 69 additions & 5 deletions jaxb-ri/codemodel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<spotbugs.skip>false</spotbugs.skip>
<spotbugs.threshold>High</spotbugs.threshold>
<spotbugs.version>4.6.0.0</spotbugs.version>
<findsecbugs.version>1.11.0</findsecbugs.version>

<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
Expand Down Expand Up @@ -96,12 +97,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Expand All @@ -116,7 +117,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -126,7 +127,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
<configuration>
<archive>
<manifest>
Expand All @@ -143,6 +144,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -179,7 +185,26 @@
<excludeFilterFile>
${spotbugs.exclude}
</excludeFilterFile>
<fork>true</fork>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>${findsecbugs.version}</version>
</plugin>
</plugins>
</configuration>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>7.1.0</version>
<configuration>
<failBuildOnCVSS>7</failBuildOnCVSS>
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
<formats>
<format>HTML</format>
<format>CSV</format>
</formats>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -388,4 +413,43 @@
</plugins>
</build>

<profiles>
<profile>
<id>spotbugs</id>
<build>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>spotbugs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dependency-check</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading

0 comments on commit 7a829b5

Please sign in to comment.