--- old/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java 2017-02-14 14:26:18.220438082 +0300 +++ new/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java 2017-02-14 14:26:18.112437391 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -144,12 +144,9 @@ public boolean buildModel(String endpoint, Listener listener) throws BadCommandLineException { final ErrorReceiverFilter errReceiver = new ErrorReceiverFilter(listener); - List args = new ArrayList(6 + (options.nocompile ? 1 : 0) + List args = new ArrayList<>(6 + (options.nocompile ? 1 : 0) + (options.encoding != null ? 2 : 0)); - args.add("--add-modules"); - args.add("java.xml.ws"); - args.add("-d"); args.add(options.destDir.getAbsolutePath()); args.add("-classpath"); @@ -163,8 +160,27 @@ args.add("-encoding"); args.add(options.encoding); } + + boolean addModules = true; if (options.javacOptions != null) { - args.addAll(options.getJavacOptions(args, listener)); + List javacOptions = options.getJavacOptions(args, listener); + for (int i = 0; i < javacOptions.size(); i++) { + String opt = javacOptions.get(i); + if ("-source".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) { + addModules = false; + } + if ("-target".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) { + addModules = false; + } + if ("-release".equals(opt) && 9 >= getVersion(javacOptions.get(i + 1))) { + addModules = false; + } + args.add(opt); + } + } + if (addModules) { + args.add("--add-modules"); + args.add("java.xml.ws"); } JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); @@ -227,7 +243,7 @@ com.sun.xml.internal.ws.db.DatabindingImpl rt = (com.sun.xml.internal.ws.db.DatabindingImpl) fac.createRuntime(config); final File[] wsdlFileName = new File[1]; // used to capture the generated WSDL file. - final Map schemaFiles = new HashMap(); + final Map schemaFiles = new HashMap<>(); WSDLGenInfo wsdlGenInfo = new WSDLGenInfo(); wsdlGenInfo.setSecureXmlProcessingDisabled(disableXmlSecurity); @@ -299,7 +315,7 @@ } private List getExternalFiles(List exts) { - List files = new ArrayList(); + List files = new ArrayList<>(); for (String ext : exts) { // first try absolute path ... File file = new File(ext); @@ -341,6 +357,10 @@ } } + private float getVersion(String s) { + return Float.parseFloat(s); + } + /** * "Namespace" for code needed to generate the report file. */