8142968: Module System implementation

Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282

Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Miroslav Kos <miroslav.kos@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Reviewed-by: lancea, mchung
This commit is contained in:
Alan Bateman 2016-03-17 19:04:08 +00:00
parent 829d872ec8
commit 2013b59929
14 changed files with 577 additions and 69 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -33,18 +33,23 @@ import java.io.OutputStream;
import javax.activation.DataSource;
/**
* The DataContentHandler interface is implemented by objects that can
* <p>The DataContentHandler interface is implemented by objects that can
* be used to extend the capabilities of the DataHandler's implementation
* of the Transferable interface. Through <code>DataContentHandlers</code>
* the framework can be extended to convert streams in to objects, and
* to write objects to streams. <p>
* to write objects to streams.</p>
*
* Applications don't generally call the methods in DataContentHandlers
* <p>An implementation of DataContentHandler should be a public class
* with a public no-arg constructor. If the implementation class is in
* a named module then it should be in an API package that is exported
* to the module {@code java.activation}.</p>
*
* <p>Applications don't generally call the methods in DataContentHandlers
* directly. Instead, an application calls the equivalent methods in
* DataHandler. The DataHandler will attempt to find an appropriate
* DataContentHandler that corresponds to its MIME type using the
* current DataContentHandlerFactory. The DataHandler then calls
* through to the methods in the DataContentHandler.
* through to the methods in the DataContentHandler.</p>
*
* @since 1.6
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -580,8 +580,7 @@ public class MailcapCommandMap extends CommandMap {
// if anything goes wrong, do it the old way
cl = Class.forName(name);
}
if (cl != null) // XXX - always true?
return (DataContentHandler)cl.newInstance();
return (DataContentHandler) cl.newInstance();
} catch (IllegalAccessException e) {
if (LogSupport.isLoggable())
LogSupport.log("Can't load DCH " + name, e);

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2014, 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.
*/
module java.activation {
requires public java.datatransfer;
// dependence on java.beans.Beans to be eliminated
requires java.desktop;
requires java.logging;
exports javax.activation;
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2014, 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.
*/
module java.annotations.common {
exports javax.annotation;
}

View File

@ -113,7 +113,6 @@ public final class ClassFactory {
m.put(clazz,new WeakReference<Constructor>(cons));
}
return cons.newInstance(emptyObject);
}

View File

@ -0,0 +1,136 @@
/*
* Copyright (c) 2014, 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.
*/
module java.xml.bind {
requires public java.activation;
requires public java.xml;
requires java.compiler;
requires java.desktop;
requires java.logging;
uses javax.xml.bind.JAXBContextFactory;
exports javax.xml.bind;
exports javax.xml.bind.annotation;
exports javax.xml.bind.annotation.adapters;
exports javax.xml.bind.attachment;
exports javax.xml.bind.helpers;
exports javax.xml.bind.util;
exports com.sun.istack.internal to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.istack.internal.localization to
java.xml.ws,
jdk.xml.ws;
exports com.sun.istack.internal.logging to
java.xml.ws,
jdk.xml.ws;
exports com.sun.xml.internal.bind to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.annotation to
jdk.xml.bind;
exports com.sun.xml.internal.bind.api to
java.xml.ws,
jdk.xml.bind;
exports com.sun.xml.internal.bind.api.impl to
java.xml.ws,
jdk.xml.bind;
exports com.sun.xml.internal.bind.marshaller to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.unmarshaller to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.util to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.v2 to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.v2.model.annotation to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.v2.model.core to
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.model.impl to
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.model.nav to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.bind.v2.model.runtime to
java.xml.ws;
exports com.sun.xml.internal.bind.v2.model.util to
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.runtime to
java.xml.ws,
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.runtime.unmarshaller to
java.xml.ws;
exports com.sun.xml.internal.bind.v2.schemagen to
java.xml.ws,
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.schemagen.episode to
jdk.xml.bind;
exports com.sun.xml.internal.bind.v2.schemagen.xmlschema to
java.xml.ws;
exports com.sun.xml.internal.bind.v2.util to
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.fastinfoset to
java.xml.ws;
exports com.sun.xml.internal.fastinfoset.stax to
java.xml.ws;
exports com.sun.xml.internal.fastinfoset.vocab to
java.xml.ws;
exports com.sun.xml.internal.org.jvnet.fastinfoset to
java.xml.ws;
exports com.sun.xml.internal.org.jvnet.mimepull to
java.xml.ws;
exports com.sun.xml.internal.org.jvnet.staxex to
java.xml.ws;
exports com.sun.xml.internal.org.jvnet.staxex.util to
java.xml.ws;
exports com.sun.xml.internal.txw2 to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.txw2.annotation to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
exports com.sun.xml.internal.txw2.output to
java.xml.ws,
jdk.xml.bind,
jdk.xml.ws;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -26,6 +26,7 @@
package com.sun.xml.internal.ws.api.server;
import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
import com.sun.xml.internal.ws.server.ServerRtException;
import com.sun.xml.internal.ws.streaming.TidyXMLStreamReader;
import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
@ -34,6 +35,7 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
/**
@ -111,6 +113,48 @@ public abstract class SDDocumentSource {
};
}
/**
* Creates {@link SDDocumentSource} from resource path using resolvingClass to read the resource.
* Required for Jigsaw runtime.
*
* @param resolvingClass class used to read resource
* @param path resource path
*/
public static SDDocumentSource create(final Class resolvingClass, final String path) {
return new SDDocumentSource() {
public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException {
InputStream is = inputStream();
return new TidyXMLStreamReader(xif.createXMLStreamReader(path,is), is);
}
public XMLStreamReader read() throws IOException, XMLStreamException {
InputStream is = inputStream();
return new TidyXMLStreamReader(XMLStreamReaderFactory.create(path,is,false), is);
}
public URL getSystemId() {
try {
return new URL("file://" + path);
} catch (MalformedURLException e) {
return null;
}
}
private InputStream inputStream() throws IOException {
java.lang.reflect.Module module = resolvingClass.getModule();
if (module != null) {
InputStream stream = module.getResourceAsStream(path);
if (stream != null) {
return stream;
}
}
throw new ServerRtException("cannot.load.wsdl", path);
}
};
}
/**
* Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -372,7 +372,7 @@ public class EndpointImpl extends Endpoint {
if (url != null) {
return SDDocumentSource.create(url);
}
throw new ServerRtException("cannot.load.wsdl", wsdlLocation);
return SDDocumentSource.create(implClass, wsdlLocation);
}
return null;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -197,28 +197,62 @@ public class HandlerAnnotationProcessor {
return null;
}
static InputStream getFileAsStream(Class clazz, HandlerChain chain) {
URL url = clazz.getResource(chain.file());
if (url == null) {
url = Thread.currentThread().getContextClassLoader().
getResource(chain.file());
}
if (url == null) {
String tmp = clazz.getPackage().getName();
tmp = tmp.replace('.', '/');
tmp += "/" + chain.file();
url =
Thread.currentThread().getContextClassLoader().getResource(tmp);
}
static InputStream getFileAsStream(Class clazz, HandlerChain chain) {
Package pkg = clazz.getPackage();
String filename = chain.file();
String fullpath = addPackagePath(filename, pkg);
InputStream is;
is = moduleResource(clazz, filename);
if (is != null) return is;
is = moduleResource(clazz, fullpath);
if (is != null) return is;
URL url = cpResource(clazz, filename);
if (url == null) url = cpResource(clazz, fullpath);
if (url == null) {
throw new UtilException("util.failed.to.find.handlerchain.file",
clazz.getName(), chain.file());
clazz.getName(), filename);
}
try {
return url.openStream();
} catch (IOException e) {
throw new UtilException("util.failed.to.parse.handlerchain.file",
clazz.getName(), chain.file());
clazz.getName(), filename);
}
}
private static URL cpResource(Class clazz, String name) {
URL url = clazz.getResource(name);
if (url == null) {
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
url = tccl.getResource(name);
}
return url;
}
private static InputStream moduleResource(Class resolvingClass, String name) {
java.lang.reflect.Module module = resolvingClass.getModule();
if (module != null) {
try {
InputStream stream = module.getResourceAsStream(name);
if (stream != null) {
return stream;
}
} catch(IOException e) {
throw new UtilException("util.failed.to.find.handlerchain.file",
resolvingClass.getName(), name);
}
}
return null;
}
private static String addPackagePath(String file, Package pkg) {
String tmp = pkg.getName();
tmp = tmp.replace('.', '/');
tmp += "/" + file;
return tmp;
}
}

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2015, 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.
*/
module java.xml.ws {
requires public java.activation;
requires public java.xml;
requires public java.xml.bind;
requires java.annotations.common;
requires java.desktop;
requires java.logging;
requires java.management;
requires java.rmi;
requires jdk.httpserver;
uses javax.xml.ws.spi.Provider;
uses javax.xml.soap.MessageFactory;
uses javax.xml.soap.SAAJMetaFactory;
uses javax.xml.soap.SOAPConnectionFactory;
uses javax.xml.soap.SOAPFactory;
exports javax.jws;
exports javax.jws.soap;
exports javax.xml.soap;
exports javax.xml.ws;
exports javax.xml.ws.handler;
exports javax.xml.ws.handler.soap;
exports javax.xml.ws.http;
exports javax.xml.ws.soap;
exports javax.xml.ws.spi;
exports javax.xml.ws.spi.http;
exports javax.xml.ws.wsaddressing;
exports com.oracle.webservices.internal.api.databinding to
jdk.xml.ws;
exports com.sun.xml.internal.ws.addressing to
jdk.xml.ws,
java.xml.bind;
exports com.sun.xml.internal.ws.addressing.v200408 to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.addressing to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.databinding to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.model to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.server to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.streaming to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.wsdl.parser to
jdk.xml.ws;
exports com.sun.xml.internal.ws.api.wsdl.writer to
jdk.xml.ws;
exports com.sun.xml.internal.ws.binding to
jdk.xml.ws;
exports com.sun.xml.internal.ws.db to
jdk.xml.ws;
exports com.sun.xml.internal.ws.model to
jdk.xml.ws;
exports com.sun.xml.internal.ws.policy.sourcemodel.wspolicy to
jdk.xml.ws;
exports com.sun.xml.internal.ws.spi.db to
jdk.xml.ws;
exports com.sun.xml.internal.ws.streaming to
jdk.xml.ws;
exports com.sun.xml.internal.ws.util to
jdk.xml.ws;
exports com.sun.xml.internal.ws.util.exception to
jdk.xml.ws;
exports com.sun.xml.internal.ws.util.xml to
jdk.xml.ws;
exports com.sun.xml.internal.ws.wsdl.parser to
jdk.xml.ws;
exports com.sun.xml.internal.ws.wsdl.writer to
jdk.xml.ws;
// XML document content needs to be exported
exports com.sun.xml.internal.ws.runtime.config to java.xml.bind;
// com.sun.xml.internal.ws.fault.SOAPFaultBuilder uses JAXBContext.newInstance
exports com.sun.xml.internal.ws.fault to java.xml.bind;
// JAF data handlers
exports com.sun.xml.internal.messaging.saaj.soap to
java.activation;
exports com.sun.xml.internal.ws.encoding to
java.activation;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -33,7 +33,6 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URL;
import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
@ -69,22 +68,17 @@ public final class JStaticJavaFile extends JResourceFile {
private final JPackage pkg;
private final String className;
private final URL source;
private final ResourceLoader source;
private final JStaticClass clazz;
private final LineFilter filter;
public JStaticJavaFile(JPackage _pkg, String className, String _resourceName) {
this( _pkg, className,
SecureLoader.getClassClassLoader(JStaticJavaFile.class).getResource(_resourceName), null );
}
public JStaticJavaFile(JPackage _pkg, String _className, URL _source, LineFilter _filter ) {
super(_className+".java");
if(_source==null) throw new NullPointerException();
public JStaticJavaFile(JPackage _pkg, String _className, Class<?> loadingClass, LineFilter _filter) {
super(_className + ".java");
if (loadingClass == null) throw new NullPointerException();
this.pkg = _pkg;
this.clazz = new JStaticClass();
this.className = _className;
this.source = _source;
this.source = new ResourceLoader(_className, loadingClass);
this.filter = _filter;
}
@ -100,14 +94,13 @@ public final class JStaticJavaFile extends JResourceFile {
}
protected void build(OutputStream os) throws IOException {
InputStream is = source.openStream();
BufferedReader r = new BufferedReader(new InputStreamReader(is));
PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os)));
LineFilter filter = createLineFilter();
int lineNumber=1;
try {
try (
InputStream is = source.getResourceAsStream();
BufferedReader r = new BufferedReader(new InputStreamReader(is));
PrintWriter w = new PrintWriter(new BufferedWriter(new OutputStreamWriter(os)));
) {
LineFilter filter = createLineFilter();
String line;
while((line=r.readLine())!=null) {
line = filter.process(line);
@ -118,9 +111,6 @@ public final class JStaticJavaFile extends JResourceFile {
} catch( ParseException e ) {
throw new IOException("unable to process "+source+" line:"+lineNumber+"\n"+e.getMessage());
}
w.close();
r.close();
}
/**
@ -235,5 +225,32 @@ public final class JStaticJavaFile extends JResourceFile {
protected JClass substituteParams(JTypeVar[] variables, List<JClass> bindings) {
return this;
}
};
}
static class ResourceLoader {
Class<?> loadingClass;
String shortName;
ResourceLoader(String shortName, Class<?> loadingClass) {
this.loadingClass = loadingClass;
this.shortName = shortName;
}
InputStream getResourceAsStream() {
// some people didn't like our jars to contain files with .java extension,
// so when we build jars, we'' use ".java_". But when we run from the workspace,
// we want the original source code to be used, so we check both here.
// see bug 6211503.
InputStream stream = loadingClass.getResourceAsStream(shortName + ".java");
if (stream == null) {
stream = loadingClass.getResourceAsStream(shortName + ".java_");
}
if (stream == null) {
throw new InternalError("Unable to load source code of " + loadingClass.getName() + " as a resource");
}
return stream;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, 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
@ -28,7 +28,6 @@ package com.sun.tools.internal.xjc.generator.bean;
import static com.sun.tools.internal.xjc.outline.Aspect.EXPOSED;
import java.io.Serializable;
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
@ -809,26 +808,14 @@ public final class BeanGenerator implements Outline {
}
public JClass generateStaticClass(Class src, JPackage out) {
String shortName = getShortName(src.getName());
// some people didn't like our jars to contain files with .java extension,
// so when we build jars, we'' use ".java_". But when we run from the workspace,
// we want the original source code to be used, so we check both here.
// see bug 6211503.
URL res = src.getResource(shortName + ".java");
if (res == null) {
res = src.getResource(shortName + ".java_");
}
if (res == null) {
throw new InternalError("Unable to load source code of " + src.getName() + " as a resource");
}
JStaticJavaFile sjf = new JStaticJavaFile(out, shortName, res, null);
JStaticJavaFile sjf = new JStaticJavaFile(out, getShortName(src), src, null);
out.addResourceFile(sjf);
return sjf.getJClass();
}
private String getShortName(String name) {
private String getShortName(Class src) {
String name = src.getName();
return name.substring(name.lastIndexOf('.') + 1);
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2014, 2015, 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.
*/
module jdk.xml.bind {
requires java.activation;
requires java.compiler;
requires java.desktop;
requires java.logging;
requires java.xml;
requires java.xml.bind;
requires jdk.compiler;
exports com.sun.codemodel.internal to
jdk.xml.ws;
exports com.sun.codemodel.internal.writer to
jdk.xml.ws;
exports com.sun.istack.internal.tools to
jdk.xml.ws;
exports com.sun.tools.internal.jxc.ap to
jdk.xml.ws;
exports com.sun.tools.internal.jxc.model.nav to
jdk.xml.ws;
exports com.sun.tools.internal.xjc to
jdk.xml.ws;
exports com.sun.tools.internal.xjc.api to
jdk.xml.ws;
exports com.sun.tools.internal.xjc.reader to
jdk.xml.ws;
exports com.sun.tools.internal.xjc.reader.internalizer to
jdk.xml.ws;
exports com.sun.tools.internal.xjc.util to
jdk.xml.ws;
exports com.sun.xml.internal.xsom.parser to
jdk.xml.ws;
// XML document content needs to be exported
exports com.sun.tools.internal.xjc.reader.xmlschema.bindinfo to
java.xml.bind;
// com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BindInfo uses JAXBContext
exports com.sun.tools.internal.xjc.generator.bean to java.xml.bind;
uses com.sun.tools.internal.xjc.Plugin;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.accessors.PluginImpl;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.at_generated.PluginImpl;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.code_injector.PluginImpl;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.episode.PluginImpl;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.locator.SourceLocationAddOn;
provides com.sun.tools.internal.xjc.Plugin with com.sun.tools.internal.xjc.addon.sync.SynchronizedMethodAddOn;
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2014, 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.
*/
module jdk.xml.ws {
requires java.compiler;
requires java.logging;
requires java.rmi;
requires java.xml;
requires java.xml.bind;
requires java.xml.ws;
requires jdk.xml.bind;
uses com.sun.tools.internal.ws.wscompile.Plugin;
provides com.sun.tools.internal.ws.wscompile.Plugin with com.sun.tools.internal.ws.wscompile.plugin.at_generated.PluginImpl;
}