8187599: Remove dependency of Building Nimbus L&F on JAXB
authorssadetsky
Mon, 16 Oct 2017 08:47:59 -0700
changeset 47389 18c850407be9
parent 47388 19b912843392
child 47390 1a818b395dba
8187599: Remove dependency of Building Nimbus L&F on JAXB Reviewed-by: serb, prr
make/jdk/src/classes/build/tools/generatenimbus/AbstractGradient.java
make/jdk/src/classes/build/tools/generatenimbus/Border.java
make/jdk/src/classes/build/tools/generatenimbus/Canvas.java
make/jdk/src/classes/build/tools/generatenimbus/Dimension.java
make/jdk/src/classes/build/tools/generatenimbus/Ellipse.java
make/jdk/src/classes/build/tools/generatenimbus/Generator.java
make/jdk/src/classes/build/tools/generatenimbus/Gradient.java
make/jdk/src/classes/build/tools/generatenimbus/GradientStop.java
make/jdk/src/classes/build/tools/generatenimbus/Insets.java
make/jdk/src/classes/build/tools/generatenimbus/Layer.java
make/jdk/src/classes/build/tools/generatenimbus/Matte.java
make/jdk/src/classes/build/tools/generatenimbus/ObjectFactory.java
make/jdk/src/classes/build/tools/generatenimbus/Path.java
make/jdk/src/classes/build/tools/generatenimbus/Point.java
make/jdk/src/classes/build/tools/generatenimbus/RadialGradient.java
make/jdk/src/classes/build/tools/generatenimbus/Rectangle.java
make/jdk/src/classes/build/tools/generatenimbus/Shape.java
make/jdk/src/classes/build/tools/generatenimbus/SynthModel.java
make/jdk/src/classes/build/tools/generatenimbus/Typeface.java
make/jdk/src/classes/build/tools/generatenimbus/UIColor.java
make/jdk/src/classes/build/tools/generatenimbus/UIComponent.java
make/jdk/src/classes/build/tools/generatenimbus/UIDefault.java
make/jdk/src/classes/build/tools/generatenimbus/UIFont.java
make/jdk/src/classes/build/tools/generatenimbus/UIIconRegion.java
make/jdk/src/classes/build/tools/generatenimbus/UIProperty.java
make/jdk/src/classes/build/tools/generatenimbus/UIRegion.java
make/jdk/src/classes/build/tools/generatenimbus/UIState.java
make/jdk/src/classes/build/tools/generatenimbus/UIStateType.java
make/jdk/src/classes/build/tools/generatenimbus/UIStyle.java
--- a/make/jdk/src/classes/build/tools/generatenimbus/AbstractGradient.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/AbstractGradient.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,16 +25,41 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-
 class AbstractGradient extends Paint {
-    public static enum CycleMethod {
+    public enum CycleMethod {
         NO_CYCLE, REFLECT, REPEAT
     }
 
-    @XmlElement(name="stop") private ArrayList<GradientStop> stops;
+    private ArrayList<GradientStop> stops;
     public List<GradientStop> getStops() { return stops; }
+
+    AbstractGradient(XMLStreamReader reader) throws XMLStreamException {
+        stops = new ArrayList<>();
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stop":
+                            stops.add(new GradientStop(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stop":
+                            break;
+                        default:
+                            return;
+                    }
+                    break;
+            }
+        }
+
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Border.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Border.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,20 +25,41 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.stream.XMLStreamReader;
 
 class Border {
     enum BorderType {
-        @XmlEnumValue("empty") EMPTY,
-        @XmlEnumValue("painter") PAINTER
+        EMPTY,
+        PAINTER
     }
-    @XmlAttribute private BorderType type;
-    @XmlAttribute private String painter;
-    @XmlAttribute private int top;
-    @XmlAttribute private int left;
-    @XmlAttribute private int bottom;
-    @XmlAttribute private int right;
+
+    private BorderType type;
+
+    private String painter;
+
+    private int top;
+
+    private int left;
+
+    private int bottom;
+
+    private int right;
+
+    Border(XMLStreamReader reader) {
+        switch (reader.getAttributeValue(null, "type")) {
+            case "empty":
+                type = BorderType.EMPTY;
+                break;
+            case "painter":
+                type =BorderType.PAINTER;
+                break;
+        }
+        painter = reader.getAttributeValue(null, "painter");
+        top = Integer.parseInt(reader.getAttributeValue(null, "top"));
+        left = Integer.parseInt(reader.getAttributeValue(null, "left"));
+        bottom = Integer.parseInt(reader.getAttributeValue(null, "bottom"));
+        right = Integer.parseInt(reader.getAttributeValue(null, "right"));
+    }
 
     public String write() {
         switch (type) {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Canvas.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Canvas.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,18 +25,49 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-
 class Canvas {
-    @XmlElement private Dimension size;
+    private Dimension size;
+
     public Dimension getSize() { return size; }
 
-    @XmlElement(name="layer") private List<Layer> layers;
+    private List<Layer> layers;
     public List<Layer> getLayers() { return layers; }
 
-    @XmlElement private Insets stretchingInsets = null;
+    private Insets stretchingInsets = null;
+
+    Canvas(XMLStreamReader reader) throws XMLStreamException {
+        layers = new ArrayList<>();
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "size":
+                            size = new Dimension(reader);
+                            break;
+                        case "layer":
+                            layers.add(new Layer(reader));
+                            break;
+                        case "stretchingInsets":
+                            stretchingInsets = new Insets(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "canvas":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public Insets getStretchingInsets() { return stretchingInsets; }
 
     public boolean isBlank() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Dimension.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Dimension.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,11 +25,16 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Dimension {
-    @XmlAttribute int width;
-    @XmlAttribute int height;
+    int width;
+    int height;
+
+    Dimension(XMLStreamReader reader) {
+        width = Integer.parseInt(reader.getAttributeValue(null, "width"));
+        height = Integer.parseInt(reader.getAttributeValue(null, "height"));
+    }
 
     public String write(boolean uiResource) {
         String uiSuffix = (uiResource ? "UIResource" : "");
--- a/make/jdk/src/classes/build/tools/generatenimbus/Ellipse.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Ellipse.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,18 +25,55 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class Ellipse extends Shape {
-    @XmlAttribute private double x1;
+    private double x1;
+
     public double getX1() { return x1; }
 
-    @XmlAttribute private double x2;
+    private double x2;
     public double getX2() { return x2; }
 
-    @XmlAttribute private double y1;
+    private double y1;
     public double getY1() { return y1; }
 
-    @XmlAttribute private double y2;
+    private double y2;
     public double getY2() { return y2; }
+
+    Ellipse(XMLStreamReader reader) throws XMLStreamException {
+        x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+        x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+        y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+        y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "ellipse":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Generator.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Generator.java	Mon Oct 16 08:47:59 2017 -0700
@@ -24,11 +24,12 @@
  */
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.io.*;
 import java.util.HashMap;
 import java.util.Map;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
 
 /**
  * Generates the various Java artifacts based on a SynthModel.
@@ -105,9 +106,14 @@
             System.out.println("   packagePrefix :" +packagePrefix);
             System.out.println("   lafName       :" +lafName);
 
-            JAXBContext ctx = JAXBContext.newInstance("build.tools.generatenimbus");
-            Unmarshaller u = ctx.createUnmarshaller();
-            SynthModel model = (SynthModel) u.unmarshal(skinFile);
+            SynthModel model;
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+            XMLStreamReader reader;
+            try( InputStream fis = new FileInputStream(skinFile);
+                 InputStream is = new BufferedInputStream(fis)) {
+                reader = inputFactory.createXMLStreamReader(is);
+                model = new SynthModel(reader);
+            }
             Generator.init(full, buildDir, packagePrefix, lafName, model);
             Generator.getInstance().generate();
         }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Gradient.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Gradient.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,5 +25,11 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 class Gradient extends AbstractGradient {
+    Gradient(XMLStreamReader reader) throws XMLStreamException {
+        super(reader);
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/GradientStop.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/GradientStop.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,16 +25,32 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class GradientStop {
-    @XmlAttribute private float position;
+    private float position;
+
     public float getPosition() { return position; }
 
-    @XmlAttribute private float midpoint;
+    private float midpoint;
     public float getMidpoint() { return midpoint; }
 
-    @XmlElement private Matte matte;
+    private Matte matte;
     public Matte getColor() { return matte; }
+
+    GradientStop(XMLStreamReader reader) throws XMLStreamException {
+        position = Float.parseFloat(reader.getAttributeValue(null, "position"));
+        midpoint = Float.parseFloat(reader.getAttributeValue(null, "midpoint"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    matte = new Matte(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Insets.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Insets.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,13 +25,13 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Insets {
-    @XmlAttribute int top;
-    @XmlAttribute int left;
-    @XmlAttribute int bottom;
-    @XmlAttribute int right;
+    int top;
+    int left;
+    int bottom;
+    int right;
 
     public Insets() {
         this(0, 0, 0, 0);
@@ -44,6 +44,13 @@
         this.right = right;
     }
 
+    Insets(XMLStreamReader reader) {
+        top = Integer.parseInt(reader.getAttributeValue(null, "top"));
+        left = Integer.parseInt(reader.getAttributeValue(null, "left"));
+        bottom = Integer.parseInt(reader.getAttributeValue(null, "bottom"));
+        right = Integer.parseInt(reader.getAttributeValue(null, "right"));
+    }
+
     public String write(boolean uiResource) {
         String uiSuffix = (uiResource ? "UIResource" : "");
         return String.format("new Insets%s(%d, %d, %d, %d)",
--- a/make/jdk/src/classes/build/tools/generatenimbus/Layer.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Layer.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,22 +25,45 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlElements;
-
 class Layer {
     /** List of shapes in this layer, first shape is painted on top */
-    @XmlElements({
-        @XmlElement(name = "ellipse", type = Ellipse.class),
-        @XmlElement(name = "path", type = Path.class),
-        @XmlElement(name = "rectangle", type = Rectangle.class)
-    })
-    @XmlElementWrapper(name="shapes")
     private List<Shape> shapes = new ArrayList<Shape>();
+
+    Layer(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "shapes":
+                            shapes = new ArrayList<>();
+                            break;
+                        case "ellipse":
+                            shapes.add(new Ellipse(reader));
+                            break;
+                        case "path":
+                            shapes.add(new Path(reader));
+                            break;
+                        case "rectangle":
+                            shapes.add(new Rectangle(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "layer":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public List<Shape> getShapes() { return shapes; }
 
     public boolean isEmpty() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/Matte.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Matte.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,24 +25,47 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
+import java.util.Optional;
 
 class Matte extends Paint {
-    @XmlAttribute private int red;
-    @XmlAttribute private int green;
-    @XmlAttribute private int blue;
-    @XmlAttribute private int alpha;
+    private int red;
+    private int green;
+    private int blue;
+    private int alpha;
 
-    @XmlAttribute private String uiDefaultParentName = null;
-    @XmlAttribute private float hueOffset = 0;
-    @XmlAttribute private float saturationOffset = 0;
-    @XmlAttribute private float brightnessOffset = 0;
-    @XmlAttribute private int alphaOffset = 0;
+    private String uiDefaultParentName = null;
+    private float hueOffset = 0;
+    private float saturationOffset = 0;
+    private float brightnessOffset = 0;
+    private int alphaOffset = 0;
 
-    @XmlAttribute private String componentPropertyName = null;
+    private String componentPropertyName = null;
+
     public String getComponentPropertyName() { return componentPropertyName; }
 
-    @XmlAttribute private boolean uiResource = true;
+    private boolean uiResource = true;
+
+    Matte(XMLStreamReader reader) {
+        red = Integer.parseInt(reader.getAttributeValue(null, "red"));
+        green = Integer.parseInt(reader.getAttributeValue(null, "green"));
+        blue = Integer.parseInt(reader.getAttributeValue(null, "blue"));
+        alpha = Integer.parseInt(reader.getAttributeValue(null, "alpha"));
+        uiDefaultParentName = reader.getAttributeValue(null,
+                "uiDefaultParentName");
+        hueOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "hueOffset"));
+        saturationOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "saturationOffset"));
+        brightnessOffset = Float.parseFloat(reader.getAttributeValue(null,
+                "brightnessOffset"));
+        alphaOffset = Integer.parseInt(reader.getAttributeValue(null,
+                "alphaOffset"));
+        componentPropertyName = reader.getAttributeValue(null,
+                "componentPropertyName");
+        uiResource = Boolean.parseBoolean(Optional.ofNullable(
+                reader.getAttributeValue(null, "uiResource")).orElse("true"));
+    }
 
     public boolean isAbsolute() {
         return uiDefaultParentName == null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/ObjectFactory.java	Mon Oct 16 08:34:01 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package build.tools.generatenimbus;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the test package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups.  Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-    /**
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test
-     *
-     */
-    public ObjectFactory() {
-    }
-
-    /**
-     * Create an instance of {@link SynthModel }
-     *
-     */
-    public SynthModel createSynthModel() {
-        return new SynthModel();
-    }
-}
--- a/make/jdk/src/classes/build/tools/generatenimbus/Path.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Path.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,15 +25,49 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
+class Path extends Shape {
+    private List<Point> controlPoints = new ArrayList<Point>();
 
-class Path extends Shape {
-    @XmlElement(name="point")
-    @XmlElementWrapper(name="points")
-    private List<Point> controlPoints = new ArrayList<Point>();
+    Path(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "points":
+                            controlPoints = new ArrayList<>();
+                            break;
+                        case "point":
+                            controlPoints.add(new Point(reader));
+                            break;
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "path":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public List<Point> getControlPoints() { return controlPoints; }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Point.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Point.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,27 +25,37 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
 
 class Point {
-    @XmlAttribute private double x;
+    private double x;
+
     public double getX() { return x; }
 
-    @XmlAttribute private double y;
+    private double y;
     public double getY() { return y; }
 
-    @XmlAttribute(name="cp1x") private double cp1x;
+    private double cp1x;
     public double getCp1X() { return cp1x; }
 
-    @XmlAttribute(name="cp1y") private double cp1y;
+    private double cp1y;
     public double getCp1Y() { return cp1y; }
 
-    @XmlAttribute(name="cp2x") private double cp2x;
+    private double cp2x;
     public double getCp2X() { return cp2x; }
 
-    @XmlAttribute(name="cp2y") private double cp2y;
+    private double cp2y;
     public double getCp2Y() { return cp2y; }
 
+    Point(XMLStreamReader reader) {
+        x = Double.parseDouble(reader.getAttributeValue(null, "x"));
+        y = Double.parseDouble(reader.getAttributeValue(null, "y"));
+        cp1x = Double.parseDouble(reader.getAttributeValue(null, "cp1x"));
+        cp1y = Double.parseDouble(reader.getAttributeValue(null, "cp1y"));
+        cp2x = Double.parseDouble(reader.getAttributeValue(null, "cp2x"));
+        cp2y = Double.parseDouble(reader.getAttributeValue(null, "cp2y"));
+    }
+
     public boolean isP1Sharp() {
         return cp1x == x && cp1y == y;
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/RadialGradient.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/RadialGradient.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,5 +25,11 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 class RadialGradient extends AbstractGradient {
+    RadialGradient(XMLStreamReader reader) throws XMLStreamException {
+        super(reader);
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Rectangle.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Rectangle.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,22 +25,23 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class Rectangle extends Shape {
-    @XmlAttribute private double x1;
+    private double x1;
+
     public double getX1() { return x1; }
 
-    @XmlAttribute private double x2;
+    private double x2;
     public double getX2() { return x2; }
 
-    @XmlAttribute private double y1;
+    private double y1;
     public double getY1() { return y1; }
 
-    @XmlAttribute private double y2;
+    private double y2;
     public double getY2() { return y2; }
 
-    @XmlAttribute
     public double getRounding() {
         double rounding = Math.abs(roundingX - x1) * 2;
         return rounding > 2 ? rounding : 0;
@@ -58,4 +59,38 @@
         return getRounding() > 0;
     }
 
+    Rectangle(XMLStreamReader reader) throws XMLStreamException {
+        x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+        x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+        y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+        y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        setRounding(Double.parseDouble(reader.getAttributeValue(null, "rounding")));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "matte":
+                            paint = new Matte(reader);
+                            break;
+                        case "gradient":
+                            paint = new Gradient(reader);
+                            break;
+                        case "radialGradient":
+                            paint = new RadialGradient(reader);
+                            break;
+                        case "paintPoints":
+                            paintPoints = new PaintPoints(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "rectangle":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/Shape.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Shape.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,31 +25,30 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-
+import javax.xml.stream.XMLStreamReader;
 
 public abstract class Shape {
-    @XmlElement
-    private PaintPoints paintPoints;
+    PaintPoints paintPoints;
+
     public double getPaintX1() { return paintPoints.x1; }
     public double getPaintX2() { return paintPoints.x2; }
     public double getPaintY1() { return paintPoints.y1; }
     public double getPaintY2() { return paintPoints.y2; }
 
-    @XmlElements({
-        @XmlElement(name = "matte", type = Matte.class),
-        @XmlElement(name = "gradient", type = Gradient.class),
-        @XmlElement(name = "radialGradient", type = RadialGradient.class)
-    })
-    private Paint paint;
+    Paint paint;
     public Paint getPaint() { return paint; }
 
     static class PaintPoints {
-        @XmlAttribute double x1;
-        @XmlAttribute double y1;
-        @XmlAttribute double x2;
-        @XmlAttribute double y2;
+        double x1;
+        double y1;
+        double x2;
+        double y2;
+
+        PaintPoints(XMLStreamReader reader) {
+            x1 = Double.parseDouble(reader.getAttributeValue(null, "x1"));
+            x2 = Double.parseDouble(reader.getAttributeValue(null, "x2"));
+            y1 = Double.parseDouble(reader.getAttributeValue(null, "y1"));
+            y2 = Double.parseDouble(reader.getAttributeValue(null, "y2"));
+        }
     }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/SynthModel.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/SynthModel.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,26 +25,54 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
-import javax.xml.bind.annotation.*;
-
 
-@XmlRootElement(name="synthModel")
 public class SynthModel {
-    @XmlElement private UIStyle style;
+    private UIStyle style;
 
-    @XmlElement(name="uiColor")
-    @XmlElementWrapper(name="colors")
     private ArrayList<UIColor> colors;
 
-    @XmlElement(name="uiFont")
-    @XmlElementWrapper(name="fonts")
     private ArrayList<UIFont> fonts;
 
-    @XmlElement(name="uiComponent")
-    @XmlElementWrapper(name="components")
     private ArrayList<UIComponent> components;
 
+    SynthModel(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "style":
+                            style = new UIStyle(reader);
+                            break;
+                        case "colors":
+                            colors = new ArrayList<>();
+                            break;
+                        case "fonts":
+                            fonts = new ArrayList<>();
+                            break;
+                        case "components":
+                            components = new ArrayList<>();
+                            break;
+                        case "uiColor":
+                            colors.add(new UIColor(reader));
+                            break;
+                        case "uiFont":
+                            fonts.add(new UIFont(reader));
+                            break;
+                        case "uiComponent":
+                            components.add(new UIComponent(reader));
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    break;
+            }
+        }
+    }
+
     public void initStyles() {
         for (UIComponent c: components) {
             c.initStyles(this.style);
--- a/make/jdk/src/classes/build/tools/generatenimbus/Typeface.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/Typeface.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,11 +25,11 @@
 
 package build.tools.generatenimbus;
 
-import java.awt.Font;
-
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamReader;
+import java.awt.*;
 
 class Typeface {
+
     public enum DeriveStyle {
         Default, Off, On;
 
@@ -42,12 +42,30 @@
         }
     }
 
-    @XmlAttribute private String uiDefaultParentName;
-    @XmlAttribute(name="family") private String name;
-    @XmlAttribute private int size;
-    @XmlAttribute private DeriveStyle bold = DeriveStyle.Default;
-    @XmlAttribute private DeriveStyle italic = DeriveStyle.Default;
-    @XmlAttribute private float sizeOffset = 1f;
+    private String uiDefaultParentName;
+    private String name;
+    private int size;
+    private DeriveStyle bold = DeriveStyle.Default;
+    private DeriveStyle italic = DeriveStyle.Default;
+    private float sizeOffset = 1f;
+
+    Typeface(XMLStreamReader reader) {
+        uiDefaultParentName = reader.getAttributeValue(null, "uiDefaultParentName");
+        name = reader.getAttributeValue(null, "family");
+        try {
+            size = Integer.parseInt(reader.getAttributeValue(null, "size"));
+        } catch (Exception e) {}
+        try {
+            bold = DeriveStyle.valueOf(reader.getAttributeValue(null, "bold"));
+        } catch (Exception e) {}
+        try {
+            italic = DeriveStyle.valueOf(reader.getAttributeValue(null, "italic"));
+        } catch (Exception e) {}
+        try {
+            sizeOffset = Float.parseFloat(reader.getAttributeValue(null, "sizeOffset"));
+        } catch (Exception e) {}
+    }
+
 
     public boolean isAbsolute() {
         return uiDefaultParentName == null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIColor.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIColor.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,13 +25,23 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIColor extends UIDefault<Matte> {
 
-    @XmlElement
-    public void setMatte(Matte m) {
-        setValue(m);
+    UIColor(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    setValue(new Matte(reader));
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
     }
 
     public String write() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIComponent.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIComponent.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,19 +25,41 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
+class UIComponent extends UIRegion {
+    private String componentName;
+
+    private List<UIStateType> stateTypes = new ArrayList<>();
 
-class UIComponent extends UIRegion {
-    @XmlAttribute private String componentName;
+    UIComponent(XMLStreamReader reader) throws XMLStreamException {
+        super(reader, false);
+        componentName = reader.getAttributeValue(null, "componentName");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stateType":
+                            stateTypes.add(new UIStateType(reader));
+                            break;
+                        default:
+                            parse(reader);
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiComponent":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 
-    @XmlElement(name="stateType")
-    @XmlElementWrapper(name="stateTypes")
-    private List<UIStateType> stateTypes = new ArrayList<UIStateType>();
     public List<UIStateType> getStateTypes() { return stateTypes; }
 
     @Override public String getKey() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIDefault.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIDefault.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,10 +25,8 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-
 public class UIDefault<T> {
-    @XmlAttribute private String name;
+    String name;
     private T value;
 
     public String getName() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIFont.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIFont.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,12 +25,22 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIFont extends UIDefault<Typeface> {
-    @XmlElement
-    public void setTypeface(Typeface t) {
-        setValue(t);
+    UIFont(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    setValue(new Typeface(reader));
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    return;
+            }
+        }
     }
 
     public String write() {
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIIconRegion.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIIconRegion.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,10 +25,31 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIIconRegion extends UIRegion {
-    @XmlAttribute private String basicKey;
+    private String basicKey;
+
+    UIIconRegion(XMLStreamReader reader) throws XMLStreamException {
+        super(reader, false);
+        basicKey = reader.getAttributeValue(null, "basicKey");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    parse(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiIconRegion":
+                            return;
+                    }
+                    break;
+            }
+        }
+
+    }
 
     @Override public void write(StringBuilder sb, StringBuilder styleBuffer, UIComponent comp, String prefix, String pkg) {
         Dimension size = null;
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIProperty.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIProperty.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,22 +25,60 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIProperty extends UIDefault<String> {
-    public static enum PropertyType {
+    public enum PropertyType {
         BOOLEAN, INT, FLOAT, DOUBLE, STRING, FONT, COLOR, INSETS, DIMENSION, BORDER
     }
-    @XmlAttribute private PropertyType type;
+    private PropertyType type;
+
+    private Border border;
+    private Dimension dimension;
+    private Insets insets;
+    private Matte matte;
+    private Typeface typeface;
+
+    UIProperty(XMLStreamReader reader) throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        setValue(reader.getAttributeValue(null, "value"));
+        try {
+            type = PropertyType.valueOf(reader.getAttributeValue(null, "type"));
+        } catch (Exception e) {}
 
-    @XmlElement private Border border;
-    @XmlElement private Dimension dimension;
-    @XmlElement private Insets insets;
-    @XmlElement private Matte matte;
-    @XmlElement private Typeface typeface;
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "border":
+                            border = new Border(reader);
+                            break;
+                        case "dimension":
+                            dimension = new Dimension(reader);
+                            break;
+                        case "insets":
+                            insets = new Insets(reader);
+                            break;
+                        case "matte":
+                            matte = new Matte(reader);
+                            break;
+                        case "typeface":
+                            typeface = new Typeface(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "uiProperty":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 
-    @XmlAttribute
     @Override public void setValue(String value) {
         super.setValue(value);
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIRegion.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIRegion.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,47 +25,91 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlElements;
+class UIRegion {
+    String name;
+    String key;
+    private boolean opaque = false;
 
-class UIRegion {
-    @XmlAttribute protected String name;
-    @XmlAttribute protected String key;
-    @XmlAttribute private boolean opaque = false;
+    private Insets contentMargins = new Insets(0, 0, 0, 0);
 
-    @XmlElement private Insets contentMargins = new Insets(0, 0, 0, 0);
+    protected List<UIState> backgroundStates = new ArrayList<UIState>();
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="backgroundStates")
-    protected List<UIState> backgroundStates = new ArrayList<UIState>();
     public List<UIState> getBackgroundStates() { return backgroundStates; }
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="foregroundStates")
     protected List<UIState> foregroundStates = new ArrayList<UIState>();
     public List<UIState> getForegroundStates() { return foregroundStates; }
 
-    @XmlElement(name="state")
-    @XmlElementWrapper(name="borderStates")
     protected List<UIState> borderStates = new ArrayList<UIState>();
     public List<UIState> getBorderStates() { return borderStates; }
 
-    @XmlElement private UIStyle style = new UIStyle();
+    UIStyle style = new UIStyle();
+
+    List<UIRegion> subRegions = new ArrayList<>();
+    public List<UIRegion> getSubRegions() { return subRegions; }
+
+    UIRegion(XMLStreamReader reader, boolean parse)
+                                                     throws XMLStreamException {
+        name = reader.getAttributeValue(null, "name");
+        key = reader.getAttributeValue(null, "key");
+        opaque = Boolean.parseBoolean(reader.getAttributeValue(null, "opaque"));
+        if (!parse) {
+            return;
+        }
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    parse(reader);
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "region":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
+    private List<UIState> states = new ArrayList<UIState>();
 
-    @XmlElements({
-        @XmlElement(name = "region", type = UIRegion.class),
-        @XmlElement(name = "uiComponent", type = UIComponent.class),
-        @XmlElement(name = "uiIconRegion", type = UIIconRegion.class)
-    })
-    @XmlElementWrapper(name="regions")
-    private List<UIRegion> subRegions = new ArrayList<UIRegion>();
-    public List<UIRegion> getSubRegions() { return subRegions; }
+    void parse(XMLStreamReader reader) throws XMLStreamException {
+        switch (reader.getLocalName()) {
+            case "backgroundStates":
+                backgroundStates = states = new ArrayList<>();
+                break;
+            case "foregroundStates":
+                foregroundStates = states = new ArrayList<>();
+                break;
+            case "borderStates":
+                borderStates = states = new ArrayList<>();
+                break;
+            case "style":
+                style = new UIStyle(reader);
+                break;
+            case "region":
+                subRegions.add(new UIRegion(reader, true));
+                break;
+            case "uiComponent":
+                subRegions.add(new UIComponent(reader));
+                break;
+            case "uiIconRegion":
+                subRegions.add(new UIIconRegion(reader));
+                break;
+            case "contentMargins":
+                contentMargins = new Insets(reader);
+                break;
+            case "state":
+                states.add(new UIState(reader));
+                break;
+        }
+    }
 
     protected void initStyles(UIStyle parentStyle) {
         style.setParentStyle(parentStyle);
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIState.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIState.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,30 +25,56 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+class UIState {
+    private String stateKeys;
 
-class UIState {
-    @XmlAttribute private String stateKeys;
     public String getStateKeys() { return stateKeys; }
 
     /** Indicates whether to invert the meaning of the 9-square stretching insets */
-    @XmlAttribute private boolean inverted;
+    private boolean inverted;
 
     /** A cached string representing the list of stateKeys deliminated with "+" */
     private String cachedName = null;
 
-    @XmlElement private Canvas canvas;
+    private Canvas canvas;
     public Canvas getCanvas() { return canvas; }
 
-    @XmlElement private UIStyle style;
+    private UIStyle style;
     public UIStyle getStyle() { return style; }
 
+    UIState(XMLStreamReader reader) throws XMLStreamException {
+        stateKeys = reader.getAttributeValue(null, "stateKeys");
+        inverted = Boolean.parseBoolean(reader.getAttributeValue(null, "inverted"));
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "canvas":
+                            canvas = new Canvas(reader);
+                            break;
+                        case "style":
+                            style = new UIStyle(reader);
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "state":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
+
     public boolean hasCanvas() {
         return ! canvas.isBlank();
     }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIStateType.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIStateType.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,13 +25,37 @@
 
 package build.tools.generatenimbus;
 
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
 class UIStateType {
-    @XmlAttribute private String key;
-    public String getKey() { return key; }
+    private String key;
+
+    public String
+    getKey() { return key; }
+
+    private String codeSnippet;
+    public String getCodeSnippet() { return codeSnippet; }
 
-    @XmlElement private String codeSnippet;
-    public String getCodeSnippet() { return codeSnippet; }
+    UIStateType(XMLStreamReader reader) throws XMLStreamException {
+        key = reader.getAttributeValue(null, "key");
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "codeSnippet":
+                            codeSnippet = reader.getElementText();
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "stateType":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 }
--- a/make/jdk/src/classes/build/tools/generatenimbus/UIStyle.java	Mon Oct 16 08:34:01 2017 -0700
+++ b/make/jdk/src/classes/build/tools/generatenimbus/UIStyle.java	Mon Oct 16 08:47:59 2017 -0700
@@ -25,37 +25,86 @@
 
 package build.tools.generatenimbus;
 
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import java.util.ArrayList;
 import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-
 
 class UIStyle {
-    public static enum CacheMode {
+
+    public enum CacheMode {
         NO_CACHING, FIXED_SIZES, NINE_SQUARE_SCALE
     }
 
-    @XmlElement private UIColor textForeground = null;
-    @XmlElement(name="inherit-textForeground")
+    private UIColor textForeground = null;
     private boolean textForegroundInherited = true;
 
-    @XmlElement private UIColor textBackground = null;
-    @XmlElement(name="inherit-textBackground")
+    private UIColor textBackground = null;
     private boolean textBackgroundInherited = true;
 
-    @XmlElement private UIColor background = null;
-    @XmlElement(name="inherit-background")
+    private UIColor background = null;
     private boolean backgroundInherited = true;
 
-    @XmlElement private boolean cacheSettingsInherited = true;
-    @XmlElement CacheMode cacheMode = CacheMode.FIXED_SIZES;
-    @XmlElement String maxHozCachedImgScaling = "1.0";
-    @XmlElement String maxVertCachedImgScaling = "1.0";
+    private boolean cacheSettingsInherited = true;
+    CacheMode cacheMode = CacheMode.FIXED_SIZES;
+    String maxHozCachedImgScaling = "1.0";
+    String maxVertCachedImgScaling = "1.0";
+
+    private List<UIProperty> uiProperties = new ArrayList<>();
+
+    UIStyle() {
+    }
 
-    @XmlElement(name="uiProperty")
-    @XmlElementWrapper(name="uiproperties")
-    private List<UIProperty> uiProperties = new ArrayList<UIProperty>();
+    UIStyle(XMLStreamReader reader) throws XMLStreamException {
+        while (reader.hasNext()) {
+            int eventType = reader.next();
+            switch (eventType) {
+                case XMLStreamReader.START_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "textForeground":
+                            textForeground = new UIColor(reader);
+                            break;
+                        case "textBackground":
+                            textBackground = new UIColor(reader);
+                            break;
+                        case "background":
+                            background = new UIColor(reader);
+                            break;
+                        case "uiProperty":
+                            uiProperties.add(new UIProperty(reader));
+                            break;
+                        case "inherit-textForeground":
+                            textForegroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "inherit-textBackground":
+                            textBackgroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "cacheSettingsInherited":
+                            cacheSettingsInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "inherit-background":
+                            backgroundInherited = Boolean.parseBoolean(reader.getElementText());
+                            break;
+                        case "cacheMode":
+                            cacheMode = CacheMode.valueOf(reader.getElementText());
+                            break;
+                        case "maxHozCachedImgScaling":
+                            maxHozCachedImgScaling = reader.getElementText();
+                            break;
+                        case "maxVertCachedImgScaling":
+                            maxVertCachedImgScaling = reader.getElementText();
+                            break;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    switch (reader.getLocalName()) {
+                        case "style":
+                            return;
+                    }
+                    break;
+            }
+        }
+    }
 
     private UIStyle parentStyle = null;
     public void setParentStyle(UIStyle parentStyle) {