compiler warnings - exports, constructors, unchecked casts...

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/jaxb-ri/bundles/core/src/main/java/module-info.java b/jaxb-ri/bundles/core/src/main/java/module-info.java
index 791c0ef..b8719ed 100644
--- a/jaxb-ri/bundles/core/src/main/java/module-info.java
+++ b/jaxb-ri/bundles/core/src/main/java/module-info.java
@@ -8,10 +8,14 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+/**
+ * The XML Binding implementation.
+ *
+ */
 module com.sun.xml.bind.core {
     requires transitive jakarta.xml.bind;
     requires java.compiler;
-    requires java.logging;
+    requires transitive java.logging;
 
     requires transitive jakarta.activation;
     requires transitive java.xml;
diff --git a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JClassAlreadyExistsException.java b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JClassAlreadyExistsException.java
index f2d8166..6ef0f73 100644
--- a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JClassAlreadyExistsException.java
+++ b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JClassAlreadyExistsException.java
@@ -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
@@ -18,9 +18,9 @@
  */
 public class JClassAlreadyExistsException extends Exception {
 
-	private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = -6200382663753897115L;
 
-	private final JDefinedClass existing;
+	private final transient JDefinedClass existing;
     
     public JClassAlreadyExistsException( JDefinedClass _existing ) {
         this.existing = _existing;
diff --git a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JDocComment.java b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JDocComment.java
index 0f622e4..7f02732 100644
--- a/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JDocComment.java
+++ b/jaxb-ri/codemodel/codemodel/src/main/java/com/sun/codemodel/JDocComment.java
@@ -28,13 +28,13 @@
 	private static final long serialVersionUID = 1L;
 
 	/** list of @param tags */
-    private final Map<String,JCommentPart> atParams = new HashMap<>();
+    private final transient Map<String,JCommentPart> atParams = new HashMap<>();
     
     /** list of xdoclets */
-    private final Map<String,Map<String,String>> atXdoclets = new HashMap<>();
+    private final transient Map<String,Map<String,String>> atXdoclets = new HashMap<>();
     
     /** list of @throws tags */
-    private final Map<JClass,JCommentPart> atThrows = new HashMap<>();
+    private final transient Map<JClass,JCommentPart> atThrows = new HashMap<>();
     
     /**
      * The @return tag part.
@@ -44,7 +44,7 @@
     /** The @deprecated tag */
     private JCommentPart atDeprecated = null;
 
-    private final JCodeModel owner;
+    private final transient JCodeModel owner;
 
 
     public JDocComment(JCodeModel owner) {
diff --git a/jaxb-ri/codemodel/codemodel/src/test/java/com/sun/codemodel/Issue1505Test.java b/jaxb-ri/codemodel/codemodel/src/test/java/com/sun/codemodel/Issue1505Test.java
index 563cfed..2f7ca22 100644
--- a/jaxb-ri/codemodel/codemodel/src/test/java/com/sun/codemodel/Issue1505Test.java
+++ b/jaxb-ri/codemodel/codemodel/src/test/java/com/sun/codemodel/Issue1505Test.java
@@ -32,6 +32,8 @@
         } 
     }
 
+    public Issue1505Test() {}
+
     @Test
     public void test1() {
         checks("Map<K,Pair<X,Y>>");
diff --git a/jaxb-ri/core/src/main/java/module-info.java b/jaxb-ri/core/src/main/java/module-info.java
index dad4a1e..bf55751 100644
--- a/jaxb-ri/core/src/main/java/module-info.java
+++ b/jaxb-ri/core/src/main/java/module-info.java
@@ -11,8 +11,6 @@
 /**
  * The XML Binding implementation.
  *
- * @uses jakarta.xml.bind.JAXBContextFactory
- *
  */
 module org.glassfish.jaxb.core {
     requires transitive jakarta.xml.bind;
diff --git a/jaxb-ri/external/relaxng-datatype/src/main/java/com/sun/tools/rngdatatype/helpers/DatatypeLibraryLoader.java b/jaxb-ri/external/relaxng-datatype/src/main/java/com/sun/tools/rngdatatype/helpers/DatatypeLibraryLoader.java
index 3f19eb2..7286a3d 100644
--- a/jaxb-ri/external/relaxng-datatype/src/main/java/com/sun/tools/rngdatatype/helpers/DatatypeLibraryLoader.java
+++ b/jaxb-ri/external/relaxng-datatype/src/main/java/com/sun/tools/rngdatatype/helpers/DatatypeLibraryLoader.java
@@ -59,6 +59,11 @@
 public class DatatypeLibraryLoader implements DatatypeLibraryFactory {
   private final Service service = new Service(DatatypeLibraryFactory.class);
 
+	/**
+	 * Default constructor.
+	 */
+	public DatatypeLibraryLoader() {}
+
   public DatatypeLibrary createDatatypeLibrary(String uri) {
     for (Enumeration e = service.getProviders();
 	 e.hasMoreElements();) {
diff --git a/jaxb-ri/jxc/pom.xml b/jaxb-ri/jxc/pom.xml
index d22a5a4..96673d4 100644
--- a/jaxb-ri/jxc/pom.xml
+++ b/jaxb-ri/jxc/pom.xml
@@ -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
@@ -41,7 +41,6 @@
             --module-path "${module.path}"
             -Djdk.attach.allowAttachSelf
         </argLine>
-        <jdoc.doclint>all</jdoc.doclint>
     </properties>
 
     <dependencies>
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenTask.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenTask.java
index 1b61908..50fe5cc 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenTask.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenTask.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -20,6 +20,11 @@
  */
 public class SchemaGenTask extends SchemaGenBase {
 
+    /**
+     * Default constructor.
+     */
+    public SchemaGenTask() {}
+
     @Override
     protected void setupForkCommand(String className) {
         ClassLoader loader = this.getClass().getClassLoader();
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenerator.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenerator.java
index 17c2677..39d9eb1 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenerator.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGenerator.java
@@ -41,10 +41,12 @@
  *
  * @author Bhakti Mehta
  */
-public class SchemaGenerator {
+public final class SchemaGenerator {
 
     private static final Logger LOGGER = Logger.getLogger(SchemaGenerator.class.getName());
 
+    private SchemaGenerator() {}
+
     /**
      * Runs the schema generator.
      * @param args command line arguments
@@ -223,6 +225,7 @@
     }
 
     public static final class Runner {
+        private Runner() {}
         public static boolean compile(String[] args, File episode) throws Exception {
 
             JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGeneratorFacade.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGeneratorFacade.java
index ebf4881..b01c485 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGeneratorFacade.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/SchemaGeneratorFacade.java
@@ -17,7 +17,9 @@
  * CLI entry point to schemagen that checks for JDK 5.0
  * @author Kohsuke Kawaguchi
  */
-public class SchemaGeneratorFacade {
+public final class SchemaGeneratorFacade {
+
+    private SchemaGeneratorFacade() {}
 
     public static void main(String[] args) throws Throwable {
         try {
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/AnnotationParser.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/AnnotationParser.java
index 21dc60b..d3461fb 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/AnnotationParser.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/AnnotationParser.java
@@ -53,6 +53,11 @@
 
     private ErrorReceiver errorListener;
 
+    /**
+     * Default constructor.
+     */
+    public AnnotationParser() {}
+
     @Override
     public void init(ProcessingEnvironment processingEnv) {
         super.init(processingEnv);
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/Options.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/Options.java
index 5c573a0..614f1e0 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/Options.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/ap/Options.java
@@ -40,6 +40,11 @@
 
     public final List<String> arguments = new ArrayList<>();
 
+    /**
+     * Default constructor.
+     */
+    public Options() {}
+
     public void parseArguments(String[] args) throws BadCommandLineException {
         for (int i = 0 ; i <args.length; i++) {
             if (args[i].charAt(0)== '-') {
diff --git a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/api/JXC.java b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/api/JXC.java
index 7df70ee..42ad0c0 100644
--- a/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/api/JXC.java
+++ b/jaxb-ri/jxc/src/main/java/com/sun/tools/jxc/api/JXC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -17,7 +17,10 @@
  * User: Iaroslav Savytskyi
  * Date: 25/05/12
  */
-public class JXC {
+public final class JXC {
+
+    private JXC() {}
+
     /**
      * Gets a fresh {@link JavaCompiler}.
      *
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/api/Utils.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/api/Utils.java
index 7e185e6..1fe6758 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/api/Utils.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/api/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
@@ -39,7 +40,7 @@
 
     static { // we statically initializing REFLECTION_NAVIGATOR property
         try {
-            final Class refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
+            final Class<?> refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
 
             // requires accessClassInPackage privilege
             final Method getInstance = AccessController.doPrivileged(
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ArrayInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ArrayInfoImpl.java
index c80e169..5d8c01a 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ArrayInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ArrayInfoImpl.java
@@ -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
@@ -26,7 +26,7 @@
  *
  * @author Kohsuke Kawaguchi
  */
-public class ArrayInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
+class ArrayInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
     extends TypeInfoImpl<TypeT,ClassDeclT,FieldT,MethodT>
     implements ArrayInfo<TypeT,ClassDeclT>, Location {
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ClassInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ClassInfoImpl.java
index a532612..d95f2c2 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ClassInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ClassInfoImpl.java
@@ -672,6 +672,7 @@
      *      {@code seed.readAllAnnotation()}, but taken as a parameter
      *      because the caller should know it already.
      */
+    @SuppressWarnings({"unchecked"})
     private void addProperty( PropertySeed<T,C,F,M> seed, Annotation[] annotations, boolean dummy ) {
         // since typically there's a very few annotations on a method,
         // this runs faster than checking for each annotation via readAnnotation(A)
@@ -824,19 +825,19 @@
 
                 return;
             case ATTRIBUTE:
-                properties.add(createAttributeProperty(seed));
+                properties.add((PropertyInfoImpl<T, C, F, M>) createAttributeProperty(seed));
                 return;
             case VALUE:
-                properties.add(createValueProperty(seed));
+                properties.add((PropertyInfoImpl<T, C, F, M>) createValueProperty(seed));
                 return;
             case ELEMENT:
-                properties.add(createElementProperty(seed));
+                properties.add((PropertyInfoImpl<T, C, F, M>) createElementProperty(seed));
                 return;
             case ELEMENT_REF:
-                properties.add(createReferenceProperty(seed));
+                properties.add((PropertyInfoImpl<T, C, F, M>) createReferenceProperty(seed));
                 return;
             case MAP:
-                properties.add(createMapProperty(seed));
+                properties.add((PropertyInfoImpl<T, C, F, M>) createMapProperty(seed));
                 return;
             default:
                 assert false;
@@ -862,23 +863,23 @@
         }
     }
 
-    protected ReferencePropertyInfoImpl<T,C,F,M> createReferenceProperty(PropertySeed<T,C,F,M> seed) {
+    protected ReferencePropertyInfo<T,C> createReferenceProperty(PropertySeed<T,C,F,M> seed) {
         return new ReferencePropertyInfoImpl<>(this,seed);
     }
 
-    protected AttributePropertyInfoImpl<T,C,F,M> createAttributeProperty(PropertySeed<T,C,F,M> seed) {
+    protected AttributePropertyInfo<T,C> createAttributeProperty(PropertySeed<T,C,F,M> seed) {
         return new AttributePropertyInfoImpl<>(this,seed);
     }
 
-    protected ValuePropertyInfoImpl<T,C,F,M> createValueProperty(PropertySeed<T,C,F,M> seed) {
+    protected ValuePropertyInfo<T,C> createValueProperty(PropertySeed<T,C,F,M> seed) {
         return new ValuePropertyInfoImpl<>(this,seed);
     }
 
-    protected ElementPropertyInfoImpl<T,C,F,M> createElementProperty(PropertySeed<T,C,F,M> seed) {
+    protected ElementPropertyInfo<T,C> createElementProperty(PropertySeed<T,C,F,M> seed) {
         return new ElementPropertyInfoImpl<>(this,seed);
     }
 
-    protected MapPropertyInfoImpl<T,C,F,M> createMapProperty(PropertySeed<T,C,F,M> seed) {
+    protected MapPropertyInfo<T,C> createMapProperty(PropertySeed<T,C,F,M> seed) {
         return new MapPropertyInfoImpl<>(this,seed);
     }
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/DummyPropertyInfo.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/DummyPropertyInfo.java
index a569345..071b7b9 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/DummyPropertyInfo.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/DummyPropertyInfo.java
@@ -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
@@ -18,5 +18,5 @@
  * @author Martin Grebac
  */
 public interface DummyPropertyInfo<T, C, F, M> {
-    void addType(PropertyInfoImpl<T, C, F, M> info);
+    void addType(PropertyInfo<T,C> info);
 }
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ModelBuilder.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ModelBuilder.java
index 9b03915..047d676 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ModelBuilder.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ModelBuilder.java
@@ -117,7 +117,7 @@
             defaultNamespaceRemap = "";
         this.defaultNsUri = defaultNamespaceRemap;
         reader.setErrorHandler(proxyErrorHandler);
-        typeInfoSet = createTypeInfoSet();
+        typeInfoSet = (TypeInfoSetImpl<T, C, F, M>) createTypeInfoSet();
     }
 
     /*
@@ -169,7 +169,7 @@
         logger = Logger.getLogger(ModelBuilder.class.getName());
     }
 
-    protected TypeInfoSetImpl<T,C,F,M> createTypeInfoSet() {
+    protected TypeInfoSet<T,C,F,M> createTypeInfoSet() {
         return new TypeInfoSetImpl<>(nav,reader,BuiltinLeafInfoImpl.createLeaves(nav));
     }
 
@@ -197,7 +197,7 @@
             return r;
 
         if(nav.isEnum(clazz)) {
-            EnumLeafInfoImpl<T,C,F,M> li = createEnumLeafInfo(clazz,upstream);
+            EnumLeafInfoImpl<T,C,F,M> li = (EnumLeafInfoImpl<T, C, F, M>) createEnumLeafInfo(clazz,upstream);
             typeInfoSet.add(li);
             r = li;
             addTypeName(r);
@@ -212,7 +212,7 @@
                 r = getClassInfo( nav.getSuperClass(clazz), searchForSuperClass,
                         new ClassLocatable<>(upstream,clazz,nav) );
             } else {
-                ClassInfoImpl<T,C,F,M> ci = createClassInfo(clazz,upstream);
+                ClassInfoImpl<T,C,F,M> ci = (ClassInfoImpl<T, C, F, M>) createClassInfo(clazz,upstream);
                 typeInfoSet.add(ci);
 
                 // compute the closure by eagerly expanding references
@@ -321,8 +321,7 @@
         if(r!=null)     return r;
 
         if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null
-            ArrayInfoImpl<T,C,F,M> ai =
-                createArrayInfo(upstream, t);
+            ArrayInfoImpl<T,C,F,M> ai = (ArrayInfoImpl<T, C, F, M>) createArrayInfo(upstream, t);
             addTypeName(ai);
             typeInfoSet.add(ai);
             return ai;
@@ -349,20 +348,20 @@
     }
 
 
-    protected EnumLeafInfoImpl<T,C,F,M> createEnumLeafInfo(C clazz,Locatable upstream) {
+    protected EnumLeafInfo<T,C> createEnumLeafInfo(C clazz,Locatable upstream) {
         return new EnumLeafInfoImpl<>(this,upstream,clazz,nav.use(clazz));
     }
 
-    protected ClassInfoImpl<T,C,F,M> createClassInfo(C clazz, Locatable upstream ) {
+    protected ClassInfo<T,C> createClassInfo(C clazz, Locatable upstream ) {
         return new ClassInfoImpl<>(this,upstream,clazz);
     }
 
-    protected ElementInfoImpl<T,C,F,M> createElementInfo(
-        RegistryInfoImpl<T,C,F,M> registryInfo, M m) throws IllegalAnnotationException {
-        return new ElementInfoImpl<>(this,registryInfo,m);
+    protected ElementInfo<T,C> createElementInfo(
+            RegistryInfo<T,C> registryInfo, M m) throws IllegalAnnotationException {
+        return new ElementInfoImpl<>(this, (RegistryInfoImpl<T, C, F, M>) registryInfo,m);
     }
 
-    protected ArrayInfoImpl<T,C,F,M> createArrayInfo(Locatable upstream, T arrayType) {
+    protected ArrayInfo<T,C> createArrayInfo(Locatable upstream, T arrayType) {
         return new ArrayInfoImpl<>(this,upstream,arrayType);
     }
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/PropertySeed.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/PropertySeed.java
index 597eab0..98ac91d 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/PropertySeed.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/PropertySeed.java
@@ -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
@@ -18,7 +18,7 @@
 /**
  * Exposes the core information that forms a {@link PropertyInfo}.
  */
-interface PropertySeed<T,C,F,M> extends Locatable, AnnotationSource {
+public interface PropertySeed<T,C,F,M> extends Locatable, AnnotationSource {
 
     /**
      * The name of the property is a spec defined concept --- although it doesn't do
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ReferencePropertyInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ReferencePropertyInfoImpl.java
index a0a1832..262ff8e 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ReferencePropertyInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/ReferencePropertyInfoImpl.java
@@ -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
@@ -350,7 +350,8 @@
     }
 
     @Override
-    public final void addType(PropertyInfoImpl<T,C,F,M> info) {
+    @SuppressWarnings({"unchecked"})
+    public void addType(PropertyInfo<T, C> info) {
         //noinspection unchecked
         subTypes.add((ReferencePropertyInfoImpl)info);
     }
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RegistryInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RegistryInfoImpl.java
index 460825e..d7782c2 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RegistryInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RegistryInfoImpl.java
@@ -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
@@ -79,7 +79,7 @@
 
             ElementInfoImpl<T,C,F,M> ei;
             try {
-                ei = builder.createElementInfo(this,m);
+                ei = (ElementInfoImpl<T, C, F, M>) builder.createElementInfo(this,m);
             } catch (IllegalAnnotationException e) {
                 builder.reportError(e);
                 continue;   // recover by ignoring this element
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeClassInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeClassInfoImpl.java
index c5468cb..588df70 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeClassInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeClassInfoImpl.java
@@ -12,6 +12,11 @@
 
 import com.sun.istack.NotNull;
 import org.glassfish.jaxb.core.annotation.XmlLocation;
+import org.glassfish.jaxb.core.v2.model.core.AttributePropertyInfo;
+import org.glassfish.jaxb.core.v2.model.core.ElementPropertyInfo;
+import org.glassfish.jaxb.core.v2.model.core.MapPropertyInfo;
+import org.glassfish.jaxb.core.v2.model.core.ReferencePropertyInfo;
+import org.glassfish.jaxb.core.v2.model.core.ValuePropertyInfo;
 import org.glassfish.jaxb.runtime.AccessorFactory;
 import org.glassfish.jaxb.runtime.AccessorFactoryImpl;
 import org.glassfish.jaxb.runtime.InternalAccessorFactory;
@@ -123,27 +128,27 @@
     }
 
     @Override
-    protected ReferencePropertyInfoImpl<Type,Class,Field,Method> createReferenceProperty(PropertySeed<Type,Class,Field,Method> seed) {
+    protected ReferencePropertyInfo<Type,Class> createReferenceProperty(PropertySeed<Type,Class,Field,Method> seed) {
         return new RuntimeReferencePropertyInfoImpl(this,seed);
     }
 
     @Override
-    protected AttributePropertyInfoImpl<Type,Class,Field,Method> createAttributeProperty(PropertySeed<Type,Class,Field,Method> seed) {
+    protected AttributePropertyInfo<Type,Class> createAttributeProperty(PropertySeed<Type,Class,Field,Method> seed) {
         return new RuntimeAttributePropertyInfoImpl(this,seed);
     }
 
     @Override
-    protected ValuePropertyInfoImpl<Type,Class,Field,Method> createValueProperty(PropertySeed<Type,Class,Field,Method> seed) {
+    protected ValuePropertyInfo<Type,Class> createValueProperty(PropertySeed<Type,Class,Field,Method> seed) {
         return new RuntimeValuePropertyInfoImpl(this,seed);
     }
 
     @Override
-    protected ElementPropertyInfoImpl<Type,Class,Field,Method> createElementProperty(PropertySeed<Type,Class,Field,Method> seed) {
+    protected ElementPropertyInfo<Type,Class> createElementProperty(PropertySeed<Type,Class,Field,Method> seed) {
         return new RuntimeElementPropertyInfoImpl(this,seed);
     }
 
     @Override
-    protected MapPropertyInfoImpl<Type,Class,Field,Method> createMapProperty(PropertySeed<Type,Class,Field,Method> seed) {
+    protected MapPropertyInfo<Type,Class> createMapProperty(PropertySeed<Type,Class,Field,Method> seed) {
         return new RuntimeMapPropertyInfoImpl(this,seed);
     }
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeElementInfoImpl.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeElementInfoImpl.java
index 9d4b2eb..e21dae9 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeElementInfoImpl.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeElementInfoImpl.java
@@ -11,6 +11,7 @@
 package org.glassfish.jaxb.runtime.v2.model.impl;
 
 import org.glassfish.jaxb.core.v2.model.core.Adapter;
+import org.glassfish.jaxb.core.v2.model.core.RegistryInfo;
 import org.glassfish.jaxb.core.v2.runtime.IllegalAnnotationException;
 import org.glassfish.jaxb.runtime.v2.runtime.Transducer;
 import org.glassfish.jaxb.runtime.v2.runtime.reflect.Accessor;
@@ -30,9 +31,10 @@
  */
 final class RuntimeElementInfoImpl extends ElementInfoImpl<Type,Class,Field,Method>
     implements RuntimeElementInfo {
-    
-    public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException {
-        super(modelBuilder, registry, method);
+
+    @SuppressWarnings({"unchecked"})
+    public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfo registry, Method method) throws IllegalAnnotationException {
+        super(modelBuilder, (RegistryInfoImpl<Type, Class, Field, Method>) registry, method);
 
         Adapter<Type,Class> a = getProperty().getAdapter();
 
@@ -49,6 +51,7 @@
 
     class RuntimePropertyImpl extends PropertyImpl implements RuntimeElementPropertyInfo, RuntimeTypeRef {
         @Override
+        @SuppressWarnings({"unchecked"})
         public Accessor getAccessor() {
             if(adapterType==null)
                 return Accessor.JAXB_ELEMENT_VALUE;
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeModelBuilder.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeModelBuilder.java
index d90bd39..b2067b8 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeModelBuilder.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/RuntimeModelBuilder.java
@@ -12,6 +12,12 @@
 
 import com.sun.istack.Nullable;
 import org.glassfish.jaxb.core.WhiteSpaceProcessor;
+import org.glassfish.jaxb.core.v2.model.core.ArrayInfo;
+import org.glassfish.jaxb.core.v2.model.core.ClassInfo;
+import org.glassfish.jaxb.core.v2.model.core.ElementInfo;
+import org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo;
+import org.glassfish.jaxb.core.v2.model.core.RegistryInfo;
+import org.glassfish.jaxb.core.v2.model.core.TypeInfoSet;
 import org.glassfish.jaxb.runtime.api.AccessorException;
 import org.glassfish.jaxb.core.v2.model.annotation.Locatable;
 import org.glassfish.jaxb.runtime.v2.model.annotation.RuntimeAnnotationReader;
@@ -67,27 +73,27 @@
     }
 
     @Override
-    protected EnumLeafInfoImpl<Type, Class, Field, Method> createEnumLeafInfo(Class clazz, Locatable upstream) {
+    protected EnumLeafInfo<Type,Class> createEnumLeafInfo(Class clazz, Locatable upstream) {
         return new RuntimeEnumLeafInfoImpl<>(this,upstream,clazz);
     }
 
     @Override
-    protected RuntimeClassInfoImpl createClassInfo( Class clazz, Locatable upstream ) {
+    protected ClassInfo<Type, Class> createClassInfo(Class clazz, Locatable upstream ) {
         return new RuntimeClassInfoImpl(this,upstream,clazz);
     }
 
     @Override
-    public RuntimeElementInfoImpl createElementInfo(RegistryInfoImpl<Type,Class,Field,Method> registryInfo, Method method) throws IllegalAnnotationException {
+    public ElementInfo<Type, Class> createElementInfo(RegistryInfo<Type,Class> registryInfo, Method method) throws IllegalAnnotationException {
         return new RuntimeElementInfoImpl(this,registryInfo, method);
     }
 
     @Override
-    public RuntimeArrayInfoImpl createArrayInfo(Locatable upstream, Type arrayType) {
+    public ArrayInfo<Type, Class> createArrayInfo(Locatable upstream, Type arrayType) {
         return new RuntimeArrayInfoImpl(this, upstream, (Class)arrayType);
     }
 
     @Override
-    protected RuntimeTypeInfoSetImpl createTypeInfoSet() {
+    protected TypeInfoSet<Type, Class, Field, Method> createTypeInfoSet() {
         return new RuntimeTypeInfoSetImpl(reader);
     }
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/Utils.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/Utils.java
index 7a60c86..59fcdc9 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/Utils.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/model/impl/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
@@ -39,7 +40,7 @@
 
     static { // we statically initializing REFLECTION_NAVIGATOR property
         try {
-            final Class refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
+            final Class<?> refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
 
             // requires accessClassInPackage privilege
             final Method getInstance = AccessController.doPrivileged(
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/AssociationMap.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/AssociationMap.java
index 142dce7..b168d94 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/AssociationMap.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/AssociationMap.java
@@ -28,14 +28,15 @@
  *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  */
 public final class AssociationMap<XmlNode> {
-    final static class Entry<XmlNode> {
+    public final static class Entry<XmlNode> {
         /** XML element. */
     	private XmlNode element;
         /** inner peer, or null. */
         private Object inner;
         /** outer peer, or null. */
         private Object outer;
-        
+
+        private Entry() {}
         public XmlNode element() {
         	return element;
         }
@@ -117,13 +118,13 @@
     }
     
     public Object getInnerPeer( XmlNode element ) {
-        Entry e = byElement(element);
+        Entry<XmlNode> e = byElement(element);
         if(e==null)     return null;
         else            return e.inner;
     }
     
     public Object getOuterPeer( XmlNode element ) {
-        Entry e = byElement(element);
+        Entry<XmlNode> e = byElement(element);
         if(e==null)     return null;
         else            return e.outer;
     }
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/JaxBeanInfo.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/JaxBeanInfo.java
index 183fb48..b9cdcf5 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/JaxBeanInfo.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/JaxBeanInfo.java
@@ -509,7 +509,7 @@
      * jaxbType if it exists, else return null.
      *
      */
-    public final LifecycleMethods getLifecycleMethods() {
+    final LifecycleMethods getLifecycleMethods() {
         return lcm;
     }
 
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/Utils.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/Utils.java
index 3a741b6..cd41a5a 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/Utils.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/SingleMapNodeProperty.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/SingleMapNodeProperty.java
index a8b48af..cc24062 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/SingleMapNodeProperty.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/SingleMapNodeProperty.java
@@ -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
@@ -56,6 +56,7 @@
      */
     private final Class<? extends ValueT> mapImplClass;
 
+    @SuppressWarnings({"unchecked"})
     public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) {
         super(context, prop);
         acc = prop.getAccessor().optimize(context);
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/Utils.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/Utils.java
index f409ff8..3bb4a9b 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/Utils.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/property/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
@@ -39,7 +40,7 @@
 
     static { // we statically initializing REFLECTION_NAVIGATOR property
         try {
-            final Class refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
+            final Class<?> refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
 
             // requires accessClassInPackage privilege
             final Method getInstance = AccessController.doPrivileged(
diff --git a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/reflect/Utils.java b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/reflect/Utils.java
index 7d3e067..62bc3af 100644
--- a/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/reflect/Utils.java
+++ b/jaxb-ri/runtime/impl/src/main/java/org/glassfish/jaxb/runtime/v2/runtime/reflect/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
@@ -39,7 +40,7 @@
 
     static { // we statically initializing REFLECTION_NAVIGATOR property
         try {
-            final Class refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
+            final Class<?> refNav = Class.forName("org.glassfish.jaxb.core.v2.model.nav.ReflectionNavigator");
 
             // requires accessClassInPackage privilege
             final Method getInstance = AccessController.doPrivileged(
diff --git a/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/RELAXNGLoader.java b/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/RELAXNGLoader.java
index 1d1184f..60a52a6 100644
--- a/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/RELAXNGLoader.java
+++ b/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/RELAXNGLoader.java
@@ -1,6 +1,6 @@
-/**
+/*
  * Copyright (c) 2001, Thai Open Source Software Center Ltd. All rights reserved.
- * Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2022 Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
diff --git a/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/builder/relaxng/SchemaBuilderImpl.java b/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/builder/relaxng/SchemaBuilderImpl.java
index 2842798..5f3c721 100644
--- a/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/builder/relaxng/SchemaBuilderImpl.java
+++ b/jaxb-ri/txw/compiler/src/main/java/com/sun/tools/txw2/builder/relaxng/SchemaBuilderImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -43,7 +43,7 @@
  * @author Kohsuke Kawaguchi
  */
 public final class SchemaBuilderImpl implements SchemaBuilder<NameClass,Leaf,ParsedElementAnnotation,LocatorImpl,AnnotationsImpl,CommentListImpl> {
-    private final NameClassBuilderImpl ncb = new NameClassBuilderImpl();
+    private final NameClassBuilderImpl<ParsedElementAnnotation,LocatorImpl,AnnotationsImpl,CommentListImpl> ncb = new NameClassBuilderImpl<>();
     private final JClass string;
     private final DatatypeFactory dtf;
 
@@ -58,10 +58,8 @@
         return leaf;
     }
 
-
-
     @Override
-    public NameClassBuilder getNameClassBuilder() throws BuildException {
+    public NameClassBuilder<NameClass,ParsedElementAnnotation,LocatorImpl,AnnotationsImpl,CommentListImpl> getNameClassBuilder() throws BuildException {
         return ncb;
     }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Driver.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Driver.java
index 3062f26..56d99b3 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Driver.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Driver.java
@@ -50,10 +50,12 @@
 /**
  * Command Line Interface of XJC.
  */
-public class Driver {
+public final class Driver {
 
     private static final String SYSTEM_PROXY_PROPERTY = "java.net.useSystemProxies";
 
+    private Driver() {}
+
     public static void main(final String[] args) throws Exception {
         // use the platform default proxy if available.
         // see sun.net.spi.DefaultProxySelector for details.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/ErrorReceiver.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/ErrorReceiver.java
index 99f0f67..9d12991 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/ErrorReceiver.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/ErrorReceiver.java
@@ -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
@@ -43,6 +43,10 @@
  */
 public abstract class ErrorReceiver  implements ErrorHandler, ErrorListener {
 
+    /**
+     * Default constructor.
+     */
+    protected ErrorReceiver() {}
 //
 //
 // convenience methods for callers
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Messages.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Messages.java
index c5c8d7e..2a868df 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Messages.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/Messages.java
@@ -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
@@ -16,8 +16,10 @@
 /**
  * Formats error messages.
  */
-public class Messages
-{
+public final class Messages {
+
+    private Messages() {}
+
     /** Loads a string resource and formats it with specified arguments. */
     public static String format( String property, Object... args ) {
         String text = ResourceBundle.getBundle(Messages.class.getPackage().getName() +".MessageBundle").getString(property);
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJC2Task.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJC2Task.java
index 1773805..fe7000a 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJC2Task.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJC2Task.java
@@ -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
@@ -20,6 +20,12 @@
  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  */
 public class XJC2Task extends XJCBase {
+
+    /**
+     * Default constructor.
+     */
+    public XJC2Task() {}
+
     @Override
     public void execute() throws BuildException {
         super.execute();
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCFacade.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCFacade.java
index 50cc8bc..3c96626 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCFacade.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCFacade.java
@@ -23,10 +23,12 @@
  *
  * @author Kohsuke Kawaguchi
  */
-public class XJCFacade {
+public final class XJCFacade {
 
     private static final String JDK_REQUIRED = "XJC requires Java SE 8 or later. Please download it from http://www.oracle.com/technetwork/java/javase/downloads";
 
+    private XJCFacade() {}
+
     public static void main(String[] args) throws Throwable {
         String v = "3.0";      // by default, we go 3.0
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCListener.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCListener.java
index 8522a1a..9acbc48 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCListener.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCListener.java
@@ -34,12 +34,9 @@
 public abstract class XJCListener implements ErrorListener {
 
     /**
-     * @deprecated
-     *      Override {@link #generatedFile(String, int, int)}.
-     *      Deprecated in 2.0.1.
+     * Default constructor.
      */
-    @Deprecated
-    public void generatedFile(String fileName) {}
+    public XJCListener() {}
 
     /**
      * Called for each file generated by XJC.
@@ -58,9 +55,7 @@
      *
      * @since 2.0.1
      */
-    public void generatedFile(String fileName, int current, int total ) {
-        generatedFile(fileName);    // backward compatibility
-    }
+    public void generatedFile(String fileName, int current, int total ) {}
 
     /**
      * Other miscellenous messages that do not have structures
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCTask.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCTask.java
index 4acd898..ee44182 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCTask.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/XJCTask.java
@@ -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
@@ -22,6 +22,11 @@
  */
 public class XJCTask extends ProtectedTask {
 
+    /**
+     * Default constructor.
+     */
+    public XJCTask() {}
+
     private String source = "3.0";
 
     /**
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/XJC.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/XJC.java
index 3854d62..11a5cff 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/XJC.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/api/XJC.java
@@ -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
@@ -22,6 +22,8 @@
  */
 public final class XJC {
 
+    private XJC() {}
+
     /**
      * Gets a fresh {@link SchemaCompiler}.
      * 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/BeanGenerator.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/BeanGenerator.java
index 76e3c49..9171d15 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/BeanGenerator.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/BeanGenerator.java
@@ -22,6 +22,7 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import com.sun.tools.xjc.outline.ElementOutline;
 import jakarta.xml.bind.JAXBContext;
 import jakarta.xml.bind.JAXBException;
 import jakarta.xml.bind.annotation.XmlAttachmentRef;
@@ -464,8 +465,8 @@
     }
 
     @Override
-    public ElementOutlineImpl getElement(CElementInfo ei) {
-        ElementOutlineImpl def = elements.get(ei);
+    public ElementOutline getElement(CElementInfo ei) {
+        ElementOutline def = elements.get(ei);
         if (def == null && ei.hasClass()) {
             // create one. in the constructor it adds itself to the elements.
             def = new ElementOutlineImpl(this, ei);
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/ObjectFactoryGenerator.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/ObjectFactoryGenerator.java
index f70daf8..4c5e682 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/ObjectFactoryGenerator.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/ObjectFactoryGenerator.java
@@ -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
@@ -25,6 +25,12 @@
  *      Ryan Shoemaker
  */
 public abstract class ObjectFactoryGenerator {
+
+    /**
+     * Default constructor.
+     */
+    protected ObjectFactoryGenerator() {}
+
     /**
      * Adds code for the given {@link CElementInfo} to ObjectFactory.
      */
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/ContentListField.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/ContentListField.java
index 7b54f1b..18a7c07 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/ContentListField.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/ContentListField.java
@@ -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
@@ -24,6 +24,7 @@
 import com.sun.tools.xjc.generator.bean.MethodWriter;
 import com.sun.tools.xjc.model.CPropertyInfo;
 import com.sun.tools.xjc.outline.Aspect;
+import com.sun.tools.xjc.outline.FieldAccessor;
 import org.glassfish.jaxb.core.api.impl.NameConverter;
 import java.io.Serializable;
 
@@ -92,7 +93,7 @@
     @Override
     public void generateAccessors() {
         final MethodWriter writer = outline.createMethodWriter();
-        final Accessor acc = create(JExpr._this());
+        final Accessor acc = (Accessor) create(JExpr._this());
 
         // [RESULT]
         // List getXXX() {
@@ -128,7 +129,7 @@
     }
 
     @Override
-    public Accessor create(JExpression targetObject) {
+    public FieldAccessor create(JExpression targetObject) {
         return new Accessor(targetObject);
     }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/DummyListField.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/DummyListField.java
index 7ad65f8..0de7714 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/DummyListField.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/DummyListField.java
@@ -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
@@ -23,6 +23,7 @@
 import com.sun.tools.xjc.generator.bean.ClassOutlineImpl;
 import com.sun.tools.xjc.model.CPropertyInfo;
 import com.sun.tools.xjc.model.CReferencePropertyInfo;
+import com.sun.tools.xjc.outline.FieldAccessor;
 import org.glassfish.jaxb.core.annotation.OverrideAnnotationOf;
 
 /**
@@ -112,7 +113,7 @@
     public void generateAccessors() { }
 
     @Override
-    public Accessor create(JExpression targetObject) {
+    public FieldAccessor create(JExpression targetObject) {
         return new Accessor(targetObject);
     }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/FieldRendererFactory.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/FieldRendererFactory.java
index 3eb8e3e..4e10992 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/FieldRendererFactory.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/FieldRendererFactory.java
@@ -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
@@ -35,6 +35,11 @@
  */
 public class FieldRendererFactory {
 
+    /**
+     * Default constructor.
+     */
+    public FieldRendererFactory() {}
+
     public FieldRenderer getDefault() {
         return DEFAULT;
     }
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/NoExtendedContentField.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/NoExtendedContentField.java
index 1182dc5..560c334 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/NoExtendedContentField.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/NoExtendedContentField.java
@@ -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
@@ -26,6 +26,7 @@
 import com.sun.tools.xjc.model.CPropertyInfo;
 import com.sun.tools.xjc.model.CReferencePropertyInfo;
 import com.sun.tools.xjc.outline.Aspect;
+import com.sun.tools.xjc.outline.FieldAccessor;
 import org.glassfish.jaxb.core.api.impl.NameConverter;
 import java.io.Serializable;
 import java.util.Set;
@@ -95,7 +96,7 @@
     @Override
     public void generateAccessors() {
         final MethodWriter writer = outline.createMethodWriter();
-        final Accessor acc = create(JExpr._this());
+        final Accessor acc = (Accessor) create(JExpr._this());
 
         // [RESULT]
         // List getXXX() {
@@ -131,7 +132,7 @@
     }
 
     @Override
-    public Accessor create(JExpression targetObject) {
+    public FieldAccessor create(JExpression targetObject) {
         return new Accessor(targetObject);
     }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/UntypedListField.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/UntypedListField.java
index b955dac..5dd63b5 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/UntypedListField.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/generator/bean/field/UntypedListField.java
@@ -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
@@ -22,6 +22,7 @@
 import com.sun.tools.xjc.generator.bean.ClassOutlineImpl;
 import com.sun.tools.xjc.generator.bean.MethodWriter;
 import com.sun.tools.xjc.model.CPropertyInfo;
+import com.sun.tools.xjc.outline.FieldAccessor;
 import org.glassfish.jaxb.core.api.impl.NameConverter;
 
 /**
@@ -90,7 +91,7 @@
     @Override
     public void generateAccessors() {
         final MethodWriter writer = outline.createMethodWriter();
-        final Accessor acc = create(JExpr._this());
+        final Accessor acc = (Accessor) create(JExpr._this());
 
         // [RESULT]
         // List getXXX() {
@@ -126,7 +127,7 @@
     }
 
     @Override
-    public Accessor create(JExpression targetObject) {
+    public FieldAccessor create(JExpression targetObject) {
         return new Accessor(targetObject);
     }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/CDefaultValue.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/CDefaultValue.java
index 7ba83ba..a8cf797 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/CDefaultValue.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/CDefaultValue.java
@@ -24,6 +24,12 @@
  * @author Kohsuke Kawaguchi
  */
 public abstract class CDefaultValue {
+
+    /**
+     * Default constructor.
+     */
+    protected CDefaultValue() {}
+
     public abstract JExpression compute(Outline outline);
 
     /**
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/nav/Utils.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/nav/Utils.java
index e8001da..52fc20c 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/nav/Utils.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/model/nav/Utils.java
@@ -28,6 +28,7 @@
  *
  * Has *package private* access to avoid inappropriate usage.
  */
+@SuppressWarnings({"unchecked"})
 final class Utils {
 
     private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Const.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Const.java
index 6c147dd..cf84417 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Const.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Const.java
@@ -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
@@ -19,7 +19,9 @@
  * @author
  *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  */
-public class Const {
+public final class Const {
+
+    private Const() {}
     
     /** XML namespace URI. */
     public final static String XMLNS_URI =
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/RawTypeSet.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/RawTypeSet.java
index b4b5610..1f65342 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/RawTypeSet.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/RawTypeSet.java
@@ -184,6 +184,10 @@
      */
     public static abstract class Ref {
         /**
+         * Default constructor.
+         */
+        protected Ref() {}
+        /**
          * @param ep
          *      the property to which the returned {@link CTypeRef} will be
          *      added to.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/TypeUtil.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/TypeUtil.java
index 3ef0ceb..4528afd 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/TypeUtil.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/TypeUtil.java
@@ -34,9 +34,10 @@
  * @author
  *    <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
  */
-public class TypeUtil {
+public final class TypeUtil {
     
-    
+    private TypeUtil() {}
+
     /**
      * Computes the common base type of two types.
      * 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Util.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Util.java
index cd6e3d1..fa03849 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Util.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/Util.java
@@ -17,8 +17,10 @@
 
 import org.xml.sax.InputSource;
 
-public class Util
-{
+public final class Util  {
+
+    private Util() {}
+
     /**
      * Parses the specified string either as an {@link URL} or as a {@link File}.
      *
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ConnectedComponent.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ConnectedComponent.java
index 2746771..55a7232 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ConnectedComponent.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ConnectedComponent.java
@@ -29,6 +29,11 @@
     /*package*/ boolean isRequired;
 
     /**
+     * Default constructor.
+     */
+    public ConnectedComponent() {}
+
+    /**
      * Returns true iff this
      * can match a substring whose length is greater than 1.
      *
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSet.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSet.java
index ec9fd0a..1c76610 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSet.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSet.java
@@ -18,7 +18,7 @@
  *
  * @author Kohsuke Kawaguchi
  */
-interface ElementSet extends Iterable<Element> {
+public interface ElementSet extends Iterable<Element> {
     /**
      * For each element in this set, adds an edge to the given element.
      */
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSets.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSets.java
index d7f6218..7ef3fd8 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSets.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/ElementSets.java
@@ -18,6 +18,9 @@
  * @author Kohsuke Kawaguchi
  */
 public final class ElementSets {
+
+    private ElementSets() {}
+
     /**
      * Returns an union of two {@link ElementSet}s.
      *
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/Expression.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/Expression.java
index c3be280..71f81c9 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/Expression.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/Expression.java
@@ -18,6 +18,11 @@
 public abstract class Expression {
 
     /**
+     * Default constructor.
+     */
+    protected Expression() {}
+
+    /**
      * Computes {@code LAST(exp)}
      */
     abstract ElementSet lastSet();
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SinkNode.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SinkNode.java
index f35592f..2e579c6 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SinkNode.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SinkNode.java
@@ -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
@@ -15,6 +15,12 @@
  * @author Kohsuke Kawaguchi
  */
 public final class SinkNode extends Element {
+
+    /**
+     * Default constructor.
+     */
+    public SinkNode() {}
+
     @Override
     public String toString() {
         return "#sink";
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SourceNode.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SourceNode.java
index dfb217c..5b36baa 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SourceNode.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/gbind/SourceNode.java
@@ -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
@@ -15,6 +15,11 @@
  * @author Kohsuke Kawaguchi
  */
 public final class SourceNode extends Element {
+    /**
+     * Default constructor.
+     */
+    public SourceNode() {}
+
     @Override
     public String toString() {
         return "#source";
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/LocatorTable.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/LocatorTable.java
index e49d0e2..145d5db 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/LocatorTable.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/internalizer/LocatorTable.java
@@ -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
@@ -29,7 +29,12 @@
     
     /** Locations of the end element. */
     private final Map<Element, Locator> endLocations = new HashMap<>();
-    
+
+    /**
+     * Default constructor.
+     */
+    public LocatorTable() {}
+
     public void storeStartLocation( Element e, Locator loc ) {
         startLocations.put(e,new LocatorImpl(loc));
     }
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindGreen.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindGreen.java
index de4f369..336dec0 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindGreen.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindGreen.java
@@ -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
@@ -34,6 +34,11 @@
 
     private final ComplexTypeFieldBuilder ctBuilder = Ring.get(ComplexTypeFieldBuilder.class);
 
+    /**
+     * Default constructor.
+     */
+    public BindGreen() {}
+
     @Override
     public void attGroupDecl(XSAttGroupDecl ag) {
         attContainer(ag);
@@ -58,13 +63,6 @@
         ctBuilder.build(ct);
     }
 
-
-
-
-
-
-
-
     @Override
     public void attributeDecl(XSAttributeDecl xsAttributeDecl) {
         // TODO: implement this method later
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindPurple.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindPurple.java
index 5977d54..2053682 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindPurple.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindPurple.java
@@ -32,6 +32,12 @@
  * @author Kohsuke Kawaguchi
  */
 public class BindPurple extends ColorBinder {
+
+    /**
+     * Default constructor.
+     */
+    public BindPurple() {}
+
     @Override
     public void attGroupDecl(XSAttGroupDecl xsAttGroupDecl) {
         // TODO
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindRed.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindRed.java
index 7cc1ae6..835bfef 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindRed.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindRed.java
@@ -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
@@ -34,6 +34,11 @@
 
     private final ComplexTypeFieldBuilder ctBuilder = Ring.get(ComplexTypeFieldBuilder.class);
 
+    /**
+     * Default constructor.
+     */
+    public BindRed() {}
+
     @Override
     public void complexType(XSComplexType ct) {
         ctBuilder.build(ct);
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindYellow.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindYellow.java
index adaf335..a2aff85 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindYellow.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/BindYellow.java
@@ -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
@@ -26,6 +26,12 @@
  * @author Kohsuke Kawaguchi
  */
 public final class BindYellow extends ColorBinder {
+
+    /**
+     * Default constructor.
+     */
+    public BindYellow() {}
+
     @Override
     public void complexType(XSComplexType ct) {
     }
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/ErrorReporter.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/ErrorReporter.java
index 6a1e33e..910bd7e 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/ErrorReporter.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/ErrorReporter.java
@@ -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
@@ -44,6 +44,10 @@
      */
     private final ErrorReceiver errorReceiver = Ring.get(ErrorReceiver.class);
 
+    /**
+     * Default constructor.
+     */
+    public ErrorReporter() {}
 
     //
     // helper methods for classes in this package.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/Messages.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/Messages.java
index 6445f3f..1ef85f2 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/Messages.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/Messages.java
@@ -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
@@ -16,8 +16,10 @@
 /**
  * Formats error messages.
  */
-public class Messages
-{
+public final class Messages {
+
+    private Messages() {}
+
     /** Loads a string resource and formats it with specified arguments. */
     public static String format( String property, Object... args ) {
         String text = ResourceBundle.getBundle(Messages.class.getPackage().getName() +".MessageBundle").getString(property);
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/SimpleTypeBuilder.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/SimpleTypeBuilder.java
index 656390c..bfde631 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/SimpleTypeBuilder.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/SimpleTypeBuilder.java
@@ -129,6 +129,10 @@
     /** {@link TypeUse}s for the built-in types. Read-only. */
     public static final Map<String,TypeUse> builtinConversions;
 
+    /**
+     * Default constructor.
+     */
+    public SimpleTypeBuilder() {}
 
     /**
      * Entry point from outside. Builds a BGM type expression
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIConversion.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIConversion.java
index 782af3d..7e0e7e5 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIConversion.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIConversion.java
@@ -311,6 +311,11 @@
 
         private TypeUse typeUse;
 
+        /**
+         * Default constructor.
+         */
+        public UserAdapter() {}
+
         @Override
         public TypeUse getTypeUse(XSSimpleType owner) {
             if(typeUse!=null)
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIDom.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIDom.java
index a7b23ac..38cfa0c 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIDom.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIDom.java
@@ -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
@@ -29,6 +29,11 @@
     @XmlAttribute
     String type;
 
+    /**
+     * Default constructor.
+     */
+    public BIDom() {}
+
     @Override
     public final QName getName() { return NAME; }
     
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIEnum.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIEnum.java
index 978a82f..96d26a7 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIEnum.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIEnum.java
@@ -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
@@ -75,6 +75,11 @@
     @XmlTransient
     public final Map<String,BIEnumMember> members = new HashMap<>();
 
+    /**
+     * Default constructor.
+     */
+    public BIEnum() {}
+
     @Override
     public QName getName() { return NAME; }
     
@@ -108,6 +113,10 @@
      */
     static class BIEnumMember2 extends BIEnumMember {
         /**
+         * Default constructor.
+         */
+        public BIEnumMember2() {}
+        /**
          * The lexical representaion of the constant to which we are attaching.
          */
         @XmlAttribute(required=true)
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIFactoryMethod.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIFactoryMethod.java
index 646595b..3e2c141 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIFactoryMethod.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIFactoryMethod.java
@@ -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
@@ -29,7 +29,12 @@
 public class BIFactoryMethod extends AbstractDeclarationImpl {
     @XmlAttribute
     public String name;
-    
+
+    /**
+     * Default constructor.
+     */
+    public BIFactoryMethod() {}
+
     /**
      * If the given component has {@link BIInlineBinaryData} customization,
      * reflect that to the specified property.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIInlineBinaryData.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIInlineBinaryData.java
index e652ef4..0044df1 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIInlineBinaryData.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIInlineBinaryData.java
@@ -29,6 +29,11 @@
 public class BIInlineBinaryData extends AbstractDeclarationImpl {
 
     /**
+     * Default constructor.
+     */
+    public BIInlineBinaryData() {}
+
+    /**
      * If the given component has  customization,
      * reflect that to the specified property.
      */
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIProperty.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIProperty.java
index fb6b3ca..b4997cd 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIProperty.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIProperty.java
@@ -780,6 +780,7 @@
     }
 
     public static final class BaseTypeBean {
+        public BaseTypeBean() {}
         /**
          * If there's a nested javaType customization, this field
          * will keep that customization. Otherwise null.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISchemaBinding.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISchemaBinding.java
index cf94a4c..b8a1347 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISchemaBinding.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISchemaBinding.java
@@ -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
@@ -103,7 +103,12 @@
             return prefix+originalName+suffix;
         }
     }
-    
+
+    /**
+     * Default constructor.
+     */
+    public BISchemaBinding() {}
+
     /**
      * Transforms the default name produced from XML name
      * by following the customization.
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISerializable.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISerializable.java
index d6239b6..20c6bc9 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISerializable.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BISerializable.java
@@ -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
@@ -28,6 +28,11 @@
     @XmlAttribute
     public Long uid;
 
+    /**
+     * Default constructor.
+     */
+    public BISerializable() {}
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXDom.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXDom.java
index 63626c9..682baf6 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXDom.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXDom.java
@@ -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
@@ -28,4 +28,9 @@
     // unsupported yet
     @XmlAttribute
     String type = "w3c";
+
+    /**
+     * Default constructor.
+     */
+    public BIXDom() {}
 }
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXSubstitutable.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXSubstitutable.java
index e72e590..c67546f 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXSubstitutable.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BIXSubstitutable.java
@@ -26,6 +26,12 @@
  */
 @XmlRootElement(name="substitutable",namespace= Const.XJC_EXTENSION_URI)
 public final class BIXSubstitutable extends AbstractDeclarationImpl {
+
+    /**
+     * Default constructor.
+     */
+    public BIXSubstitutable() {}
+
     @Override
     public QName getName() { return NAME; }
 
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BindInfo.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BindInfo.java
index a91b0b2..fdc8b5e 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BindInfo.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/BindInfo.java
@@ -71,6 +71,11 @@
     private Documentation documentation;
 
     /**
+     * Default constructor.
+     */
+    public BindInfo() {}
+
+    /**
      * Returns true if this  doesn't contain any useful
      * information.
      *
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/CollectionTypeAttribute.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/CollectionTypeAttribute.java
index 12e51cb..9ee5165 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/CollectionTypeAttribute.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/reader/xmlschema/bindinfo/CollectionTypeAttribute.java
@@ -31,6 +31,11 @@
     @XmlTransient
     private FieldRenderer fr;
 
+    /**
+     * Default constructor.
+     */
+    public CollectionTypeAttribute() {}
+
     FieldRenderer get(Model m) {
         if(fr==null)
             fr = calcFr(m);
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/DOMUtils.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/DOMUtils.java
index ba3ba96..56328b0 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/DOMUtils.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/DOMUtils.java
@@ -34,7 +34,10 @@
  * @version 1.0
  *
  */
-public class DOMUtils {
+public final class DOMUtils {
+
+    private DOMUtils() {}
+
     /** Gets the fist child of the given name, or null. */
     public static Element getFirstChildElement( Element parent, String nsUri, String localPart ) {
         NodeList children = parent.getChildNodes();
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/NullStream.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/NullStream.java
index 140a6ed..fe2e3a0 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/NullStream.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/NullStream.java
@@ -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
@@ -21,6 +21,11 @@
  */
 public class NullStream extends OutputStream {
 
+    /**
+     * Default constructor.
+     */
+    public NullStream() {}
+
     @Override
     public void write(int b) throws IOException {
     }
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/ReadOnlyAdapter.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/ReadOnlyAdapter.java
index 88dc8a4..174fe83 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/ReadOnlyAdapter.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/ReadOnlyAdapter.java
@@ -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
@@ -18,6 +18,12 @@
  * @author Kohsuke Kawaguchi
  */
 public abstract class ReadOnlyAdapter<OnTheWire,InMemory> extends XmlAdapter<OnTheWire,InMemory> {
+
+    /**
+     * Default constructor.
+     */
+    protected ReadOnlyAdapter() {}
+
     @Override
     public final OnTheWire marshal(InMemory onTheWire) {
         // the unmarshaller uses this method
diff --git a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/SubtreeCutter.java b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/SubtreeCutter.java
index 95a4613..86a735e 100644
--- a/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/SubtreeCutter.java
+++ b/jaxb-ri/xjc/src/main/java/com/sun/tools/xjc/util/SubtreeCutter.java
@@ -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
@@ -44,6 +44,10 @@
      */
     private ContentHandler next;
 
+    /**
+     * Default constructor.
+     */
+    protected SubtreeCutter() {}
 
     @Override
     public void startDocument() throws SAXException {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/XSSchema.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/XSSchema.java
index 58fa4ed..c1f0167 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/XSSchema.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/XSSchema.java
@@ -113,7 +113,7 @@
      *      this method from  and not from {@link XSComponent},
      *      there's something wrong with your code.
      */
-    @Deprecated(since="2.3", forRemoval=true)
+    @Deprecated(since="2.3")
     SchemaDocument getSourceDocument();
 
     /**
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttGroupDeclImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttGroupDeclImpl.java
index b68530f..dce98b8 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttGroupDeclImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttGroupDeclImpl.java
@@ -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
@@ -64,7 +64,7 @@
     public void visit( XSVisitor visitor ) {
         visitor.attGroupDecl(this);
     }
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.attGroupDecl(this);
     }
 }
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeDeclImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeDeclImpl.java
index 3e9ebde..c81e9fe 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeDeclImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeDeclImpl.java
@@ -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
@@ -48,7 +48,7 @@
     public void visit( XSVisitor visitor ) {
         visitor.attributeDecl(this);
     }
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.attributeDecl(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeUseImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeUseImpl.java
index 35fb33f..857142e 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeUseImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/AttributeUseImpl.java
@@ -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
@@ -49,7 +49,7 @@
     private final boolean required;
     public boolean isRequired() { return required; }
     
-    public Object apply( XSFunction f ) {
+    public <T> T apply( XSFunction<T> f ) {
         return f.attributeUse(this);
     }
     public void visit( XSVisitor v ) {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ComponentImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ComponentImpl.java
index 8c2c07d..d36d368 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ComponentImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ComponentImpl.java
@@ -79,7 +79,7 @@
         Object t = foreignAttributes;
 
         if(t==null)
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
 
         if(t instanceof List)
             return (List)t;
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ElementDecl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ElementDecl.java
index 1154eff..34be8f6 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ElementDecl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ElementDecl.java
@@ -227,7 +227,7 @@
         visitor.elementDecl(this);
     }
     @Override
-    public Object apply( XSTermFunction function ) {
+    public <T> T apply( XSTermFunction<T> function ) {
         return function.elementDecl(this);
     }
 
@@ -237,7 +237,7 @@
     }
 
     @Override
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.elementDecl(this);
     }
     
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/EmptyImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/EmptyImpl.java
index 0f6bdcd..a352f20 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/EmptyImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/EmptyImpl.java
@@ -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
@@ -30,10 +30,10 @@
     public XSParticle asParticle()      { return null; }
     public XSContentType asEmpty()      { return this; }
     
-    public Object apply( XSContentTypeFunction function ) {
+    public <T> T apply( XSContentTypeFunction<T> function ) {
         return function.empty(this);
     }
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.empty(this);
     }
     public void visit( XSVisitor visitor ) {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/FacetImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/FacetImpl.java
index 00ec442..93ea88a 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/FacetImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/FacetImpl.java
@@ -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
@@ -41,7 +41,7 @@
     public void visit( XSVisitor visitor ) {
         visitor.facet(this);
     }
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.facet(this);
     }
 }
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ImplUtil.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ImplUtil.java
index 30ec610..708929a 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ImplUtil.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ImplUtil.java
@@ -16,6 +16,7 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -26,22 +27,22 @@
  */
 class ImplUtil {
     private static XSType[] listDirectSubstitutables( XSType _this ) {
-        ArrayList r = new ArrayList();
+        List<XSType> r = new ArrayList<>();
 
         // TODO: handle @block
-        Iterator itr = ((SchemaImpl)_this.getOwnerSchema()).parent.iterateTypes();
+        Iterator<XSType> itr = ((SchemaImpl)_this.getOwnerSchema()).parent.iterateTypes();
         while( itr.hasNext() ) {
-            XSType t = (XSType)itr.next();
+            XSType t = itr.next();
             if( t.getBaseType()==_this )
                 r.add(t);
         }
-        return (XSType[]) r.toArray(new XSType[0]);
+        return r.toArray(new XSType[0]);
     }
 
     public static XSType[] listSubstitutables( XSType _this ) {
-        Set substitables = new HashSet();
+        Set<XSType> substitables = new HashSet<>();
         buildSubstitutables( _this, substitables );
-        return (XSType[]) substitables.toArray(new XSType[0]);
+        return substitables.toArray(new XSType[0]);
     }
 
     public static void buildSubstitutables( XSType _this, Set substitutables ) {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ListSimpleTypeImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ListSimpleTypeImpl.java
index a1593b5..c9e44ae 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ListSimpleTypeImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ListSimpleTypeImpl.java
@@ -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
@@ -42,13 +42,13 @@
     public void visit( XSSimpleTypeVisitor visitor ) {
         visitor.listSimpleType(this);
     }
-    public Object apply( XSSimpleTypeFunction function ) {
+    public <T> T apply( XSSimpleTypeFunction<T> function ) {
         return function.listSimpleType(this);
     }
 
     // list type by itself doesn't have any facet. */
     public XSFacet getFacet( String name ) { return null; }
-    public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
+    public List<XSFacet> getFacets( String name ) { return Collections.emptyList(); }
 
     public XSVariety getVariety() { return XSVariety.LIST; }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupDeclImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupDeclImpl.java
index 737d6b8..ff19d65 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupDeclImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupDeclImpl.java
@@ -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
@@ -55,7 +55,7 @@
     public void visit( XSTermVisitor visitor ) {
         visitor.modelGroupDecl(this);
     }
-    public Object apply( XSTermFunction function ) {
+    public <T> T apply( XSTermFunction<T> function ) {
         return function.modelGroupDecl(this);
     }
 
@@ -63,7 +63,7 @@
         return function.modelGroupDecl(this,param);
     }
 
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.modelGroupDecl(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupImpl.java
index 9403fae..35fda3f 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ModelGroupImpl.java
@@ -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
@@ -82,7 +82,7 @@
     public void visit( XSTermVisitor visitor ) {
         visitor.modelGroup(this);
     }
-    public Object apply( XSTermFunction function ) {
+    public <T> T apply( XSTermFunction<T> function ) {
         return function.modelGroup(this);
     }
 
@@ -90,7 +90,7 @@
         return function.modelGroup(this,param);
     }
 
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.modelGroup(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/NotationImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/NotationImpl.java
index 7d72d49..b4ca03a 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/NotationImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/NotationImpl.java
@@ -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
@@ -42,7 +42,7 @@
         visitor.notation(this);
     }
 
-    public Object apply(XSFunction function) {
+    public <T> T apply(XSFunction<T> function) {
         return function.notation(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ParticleImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ParticleImpl.java
index da4db47..c4982dd 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ParticleImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/ParticleImpl.java
@@ -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
@@ -10,6 +10,7 @@
 
 package com.sun.xml.xsom.impl;
 
+import com.sun.xml.xsom.ForeignAttributes;
 import com.sun.xml.xsom.XSContentType;
 import com.sun.xml.xsom.XSParticle;
 import com.sun.xml.xsom.XSSimpleType;
@@ -77,10 +78,10 @@
     public XSContentType asEmpty()      { return null; }
     
     
-    public final Object apply( XSFunction function ) {
+    public final <T> T apply( XSFunction<T> function ) {
         return function.particle(this);
     }
-    public final Object apply( XSContentTypeFunction function ) {
+    public final <T> T apply( XSContentTypeFunction<T> function ) {
         return function.particle(this);
     }
     public final void visit( XSVisitor visitor ) {
@@ -98,7 +99,8 @@
      *
      * REVISIT: is this a good design?
      */
-    public List getForeignAttributes() {
-        return getTerm().getForeignAttributes();
+    @Override
+    public List<ForeignAttributesImpl> getForeignAttributes() {
+        return super.getForeignAttributes();
     }
 }
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/RestrictionSimpleTypeImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/RestrictionSimpleTypeImpl.java
index c7171ee..445218c 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/RestrictionSimpleTypeImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/RestrictionSimpleTypeImpl.java
@@ -96,7 +96,7 @@
     public void visit( XSSimpleTypeVisitor visitor ) {
         visitor.restrictionSimpleType(this);
     }
-    public Object apply( XSSimpleTypeFunction function ) {
+    public <T> T apply( XSSimpleTypeFunction<T> function ) {
         return function.restrictionSimpleType(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaImpl.java
index fc79190..515b358 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaImpl.java
@@ -51,6 +51,7 @@
         this.locator = loc;
     }
 
+    @SuppressWarnings({"deprecation"})
     public SchemaDocument getSourceDocument() {
         return null;
     }
@@ -243,7 +244,7 @@
         visitor.schema(this);
     }
 
-    public Object apply(XSFunction function) {
+    public <T> T apply(XSFunction<T> function) {
         return function.schema(this);
     }
 
@@ -262,7 +263,7 @@
     public List<ForeignAttributes> getForeignAttributes() {
         if(readOnlyForeignAttributes==null) {
             if(foreignAttributes==null)
-                readOnlyForeignAttributes = Collections.EMPTY_LIST;
+                readOnlyForeignAttributes = Collections.emptyList();
             else
                 readOnlyForeignAttributes = Collections.unmodifiableList(foreignAttributes);
         }
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaSetImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaSetImpl.java
index b7194f8..35881e3 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaSetImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SchemaSetImpl.java
@@ -259,7 +259,7 @@
         public XSSimpleType getSimpleBaseType() { return null; }
         public int getDerivationMethod() { return RESTRICTION; }
         public Iterator<XSFacet> iterateDeclaredFacets() { return Iterators.empty(); }
-        public Collection<? extends XSFacet> getDeclaredFacets() { return Collections.EMPTY_LIST; }
+        public Collection<? extends XSFacet> getDeclaredFacets() { return Collections.emptyList(); }
         public void visit( XSSimpleTypeVisitor visitor ) {visitor.restrictionSimpleType(this); }
         public void visit( XSContentTypeVisitor visitor ) {visitor.simpleType(this); }
         public void visit( XSVisitor visitor ) {visitor.simpleType(this); }
@@ -272,9 +272,9 @@
         public XSListSimpleType getBaseListType() {return null;}
         public XSUnionSimpleType getBaseUnionType() {return null;}
         public XSFacet getFacet(String name) { return null; }
-        public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
+        public List<XSFacet> getFacets( String name ) { return Collections.emptyList(); }
         public XSFacet getDeclaredFacet(String name) { return null; }
-        public List<XSFacet> getDeclaredFacets(String name) { return Collections.EMPTY_LIST; }
+        public List<XSFacet> getDeclaredFacets(String name) { return Collections.emptyList(); }
 
         public boolean isRestriction() { return true; }
         public boolean isList() { return false; }
@@ -308,9 +308,9 @@
         public XSAttributeUse getDeclaredAttributeUse( String nsURI, String localName ) { return null; }
         public Iterator<XSAttributeUse> iterateDeclaredAttributeUses() { return Iterators.empty(); }
         public Iterator<XSAttGroupDecl> iterateAttGroups() { return Iterators.empty(); }
-        public Collection<XSAttributeUse> getAttributeUses() { return Collections.EMPTY_LIST; }
-        public Collection<? extends XSAttributeUse> getDeclaredAttributeUses() { return Collections.EMPTY_LIST; }
-        public Collection<? extends XSAttGroupDecl> getAttGroups() { return Collections.EMPTY_LIST; }
+        public Collection<XSAttributeUse> getAttributeUses() { return Collections.emptyList(); }
+        public Collection<? extends XSAttributeUse> getDeclaredAttributeUses() { return Collections.emptyList(); }
+        public Collection<? extends XSAttGroupDecl> getAttGroups() { return Collections.emptyList(); }
         public boolean isFinal( int i ) { return false; }
         public boolean isSubstitutionProhibited( int i ) { return false; }
         public boolean isMixed() { return true; }
@@ -351,7 +351,7 @@
                 })
                 ,null,1,1);
         public List<XSComplexType> getSubtypes() {
-            ArrayList subtypeList = new ArrayList();
+            ArrayList<XSComplexType> subtypeList = new ArrayList<>();
             Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
             while (cTypes.hasNext()) {
                 XSComplexType cType= cTypes.next();
@@ -364,7 +364,7 @@
         }
 
         public List<XSElementDecl> getElementDecls() {
-            ArrayList declList = new ArrayList();
+            ArrayList<XSElementDecl> declList = new ArrayList<>();
             XSSchemaSet schemaSet = getRoot();
             for (XSSchema sch : schemaSet.getSchemas()) {
                 for (XSElementDecl decl : sch.getElementDecls().values()) {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SimpleTypeImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SimpleTypeImpl.java
index 696fe23..a836f63 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SimpleTypeImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/SimpleTypeImpl.java
@@ -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
@@ -136,10 +136,10 @@
     public final void visit( XSContentTypeVisitor visitor ) {
         visitor.simpleType(this);
     }
-    public final Object apply( XSFunction function ) {
+    public final <T> T apply( XSFunction<T> function ) {
         return function.simpleType(this);
     }
-    public final Object apply( XSContentTypeFunction function ) {
+    public final <T> T apply( XSContentTypeFunction<T> function ) {
         return function.simpleType(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/UnionSimpleTypeImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/UnionSimpleTypeImpl.java
index 0f6b19f..da4e938 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/UnionSimpleTypeImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/UnionSimpleTypeImpl.java
@@ -62,7 +62,7 @@
     public void visit( XSSimpleTypeVisitor visitor ) {
         visitor.unionSimpleType(this);
     }
-    public Object apply( XSSimpleTypeFunction function ) {
+    public <T> T apply( XSSimpleTypeFunction<T> function ) {
         return function.unionSimpleType(this);
     }
 
@@ -72,7 +72,7 @@
 
     // union type by itself doesn't have any facet. */
     public XSFacet getFacet( String name ) { return null; }
-    public List<XSFacet> getFacets( String name ) { return Collections.EMPTY_LIST; }
+    public List<XSFacet> getFacets( String name ) { return Collections.emptyList(); }
 
     public XSVariety getVariety() { return XSVariety.UNION; }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/WildcardImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/WildcardImpl.java
index c752110..54591d6 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/WildcardImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/WildcardImpl.java
@@ -90,7 +90,7 @@
         public void visit( XSWildcardVisitor visitor ) {
             visitor.any(this);
         }
-        public Object apply( XSWildcardFunction function ) {
+        public <T> T apply( XSWildcardFunction<T> function ) {
             return function.any(this);
         }
     }
@@ -113,7 +113,7 @@
         public void visit( XSWildcardVisitor visitor ) {
             visitor.other(this);
         }
-        public Object apply( XSWildcardFunction function ) {
+        public <T> T apply( XSWildcardFunction<T> function ) {
             return function.other(this);
         }
     }
@@ -144,7 +144,7 @@
         public void visit( XSWildcardVisitor visitor ) {
             visitor.union(this);
         }
-        public Object apply( XSWildcardFunction function ) {
+        public <T> T apply( XSWildcardFunction<T> function ) {
             return function.union(this);
         }
     }
@@ -155,7 +155,7 @@
     public final void visit( XSTermVisitor visitor ) {
         visitor.wildcard(this);
     }
-    public Object apply( XSTermFunction function ) {
+    public <T> T apply( XSTermFunction<T> function ) {
         return function.wildcard(this);
     }
 
@@ -163,7 +163,7 @@
         return function.wildcard(this,param);
     }
 
-    public Object apply( XSFunction function ) {
+    public <T> T apply( XSFunction<T> function ) {
         return function.wildcard(this);
     }
 
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/AbstractAxisImpl.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/AbstractAxisImpl.java
index fce2d2c..a72d644 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/AbstractAxisImpl.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/AbstractAxisImpl.java
@@ -50,6 +50,7 @@
         return Iterators.singleton(t);
     }
 
+    @SafeVarargs
     protected final Iterator<T> union(T... items) {
         return new Iterators.Array<>(items);
     }
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/Iterators.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/Iterators.java
index 749a472..8056f3f 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/Iterators.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/impl/scd/Iterators.java
@@ -28,11 +28,8 @@
         }
     }
 
-    // we need to run on JDK 1.4
-    private static final Iterator EMPTY = Collections.EMPTY_LIST.iterator();
-
     public static <T> Iterator<T> empty() {
-        return EMPTY;
+        return Collections.emptyIterator();
     }
 
     public static <T> Iterator<T> singleton(T value) {
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/ContextClassloaderLocal.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/ContextClassloaderLocal.java
index b639644..d6517a9 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/ContextClassloaderLocal.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/ContextClassloaderLocal.java
@@ -55,9 +55,8 @@
     }
 
     private static ClassLoader getContextClassLoader() {
-        return (ClassLoader)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+                    public ClassLoader run() {
                         ClassLoader cl = null;
                         try {
                             cl = Thread.currentThread().getContextClassLoader();
diff --git a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/NameGetter.java b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/NameGetter.java
index c9543a2..ee92fd0 100644
--- a/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/NameGetter.java
+++ b/jaxb-ri/xsom/src/main/java/com/sun/xml/xsom/util/NameGetter.java
@@ -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
@@ -57,14 +57,14 @@
      * An instance that gets names in the default locale.
      * This instance is provided just for convenience.
      */
-    public final static XSFunction theInstance = new NameGetter(null);
+    public final static XSFunction<String> theInstance = new NameGetter(null);
     
     /**
      * Gets the name of the specified component in the default locale.
      * This method is just a wrapper.
      */
     public static String get( XSComponent comp ) {
-        return (String)comp.apply(theInstance);
+        return comp.apply(theInstance);
     }
     
     
diff --git a/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/MapNamespaceContext.java b/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/MapNamespaceContext.java
index 3eb0593..fdcc64c 100644
--- a/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/MapNamespaceContext.java
+++ b/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/MapNamespaceContext.java
@@ -35,7 +35,7 @@
         throw new UnsupportedOperationException();
     }
 
-    public Iterator getPrefixes(String namespaceURI) {
+    public Iterator<String> getPrefixes(String namespaceURI) {
         throw new UnsupportedOperationException();
     }
 }
diff --git a/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/SCDDriver.java b/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/SCDDriver.java
index d9376b1..5cd118a 100644
--- a/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/SCDDriver.java
+++ b/jaxb-ri/xsom/src/test/java/com/sun/xml/xsom/test/SCDDriver.java
@@ -59,7 +59,7 @@
             return namespaceURI;
         }
 
-        public Iterator getPrefixes(String namespaceURI) {
+        public Iterator<String> getPrefixes(String namespaceURI) {
             return Collections.singletonList(namespaceURI).iterator();
         }
     }