This commit is contained in:
Abhijit Saha 2011-03-14 12:01:41 -07:00
commit 78d73e02da
149 changed files with 229 additions and 9183 deletions

View File

@ -74,7 +74,6 @@ import -- copy in the pre-built components (e.g. VM) \n\
import_product -- copy in the product components \n\
import_fastdebug -- copy in the fastdebug components \n\
import_debug -- copy in the debug components \n\
modules -- build the jdk and jre module images (experimental) \n\
create_links -- create softlinks in Solaris 32bit build to 64bit dirs \n\
"
@ -261,7 +260,6 @@ docs:: sanity-docs post-sanity-docs
# Release engineering targets.
#
include $(BUILDDIR)/common/Release.gmk
include $(BUILDDIR)/common/Modules.gmk
#
# Cscope targets.

View File

@ -249,7 +249,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/sunjce_provider.jar
else
$(JAR_DESTFILE): $(SIGNED_DIR)/sunjce_provider.jar
endif
$(install-non-module-file)
$(install-file)
ifndef OPENJDK
install-prebuilt:

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../..
MODULE = pack200
PACKAGE = com.sun.java.util.jar.pack
LIBRARY = unpack
PRODUCT = sun
@ -156,7 +155,6 @@ ifdef MT
endif
$(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE)
@$(call binary_file_verification,$@)
$(install-module-file)
ifeq ($(PLATFORM), windows)
$(RES):: $(VERSIONINFO_RESOURCE)

View File

@ -29,7 +29,6 @@
# to a collision of rules with Classes.gmk and Library.gmk
BUILDDIR = ../../../../..
MODULE = pack200
PACKAGE = com.sun.java.util.jar.pack
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../..
MODULE = jndi-cosnaming
PACKAGE = com.sun.jndi.cosnaming
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../..
MODULE = jndi-dns
PACKAGE = com.sun.jndi.dns
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../..
MODULE = jndi-ldap
PACKAGE = com.sun.jndi.ldap
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../../..
MODULE = jndi-rmiregistry
PACKAGE = com.sun.jndi.rmi.registry
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../..
MODULE = sctp
PACKAGE = com.sun.nio.sctp
LIBRARY = sctp
PRODUCT = sun

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../../../..
MODULE = security-xmldsig
PACKAGE = com.sun.org.apache.xml
PRODUCT = xml
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../..
MODULE = jdbc-enterprise
PACKAGE = com.sun.rowset
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -25,7 +25,6 @@
BUILDDIR = ../../..
MODULE = scripting-rhino
PACKAGE = com.sun.script
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -26,7 +26,6 @@
# Makefile for building auth modules.
BUILDDIR = ../../../../..
MODULE = security-auth
PACKAGE = com.sun.security.auth.module
PRODUCT = sun

View File

@ -22,7 +22,6 @@
# questions.
BUILDDIR = ../../..
MODULE = servicetag
PACKAGE = com.sun.servicetag
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -25,7 +25,6 @@
BUILDDIR = ../../../..
MODULE = attach
PACKAGE = com.sun.tools.attach
LIBRARY = attach
PRODUCT = sun
@ -66,8 +65,7 @@ $(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/tools/attach/META-INF/services/%
@$(MKDIR) -p $(@D)
@$(RM) $@
@$(CAT) $< | $(SED) -e "s/^#\[$(PLATFORM)\]//" > $@
@$(install-module-file)
.PHONY: copy-files

View File

@ -224,9 +224,6 @@ INCLUDEDIR = $(OUTPUTDIR)/include
# for generated class files
CLASSBINDIR = $(OUTPUTDIR)/classes
DEMOCLASSDIR = $(OUTPUTDIR)/democlasses
# for modules
MODULES_DIR = $(OUTPUTDIR)/modules
ABS_MODULES_DIR = $(ABS_OUTPUTDIR)/modules
# for generated tool class files
BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses
# for build tool jar files
@ -297,22 +294,6 @@ ifneq ($(LIBRARY),)
endif
endif
#
# Build units may or may not define MODULE. Default to "other".
#
# MODULE variable defines the lowest-level module name that
# might or might not be the name of the modules created in
# the modules build (see make/modules/modules.config and
# modules.group).
#
MODULES_TEMPDIR = $(OUTPUTDIR)/tmp/modules
ABS_MODULES_TEMPDIR = $(ABS_OUTPUTDIR)/tmp/modules
ifndef MODULE
MODULE = other
endif
override MODULE_DEST_DIR = $(MODULES_TEMPDIR)/$(MODULE)
# the use of += above makes a space separated list which we need to
# remove for filespecs.
#
@ -422,52 +403,13 @@ PKGDIR = $(subst .,/,$(PACKAGE))
#
include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk
#
# Macros to find the module that $@ belongs to
#
UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH))
MODULE_PATH_PATTERN = -e 's%.*\/classes\/%classes\/%' \
-e 's%.*\/$(UNIQUE_PATH_PATTERN)\/%classes\/%' \
-e 's%.*\/lib\/%lib\/%' \
-e 's%.*\/bin\/%bin\/%' \
-e 's%.*\/include\/%include\/%' \
-e 's%.*\/demo\/%demo\/%' \
-e 's%.*\/sample\/%sample\/%'
# Install a file to its module
define install-module-file
dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \
$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \
$(CP) -f $@ $(MODULE_DEST_DIR)/$$dest
endef
# Install all files from the directory to its module
define install-module-dir
dest=`echo $(@D)/ | $(SED) $(MODULE_PATH_PATTERN)` ; \
$(MKDIR) -p $(MODULE_DEST_DIR)/$$dest; \
$(CP) -rf $(@D)/* $(MODULE_DEST_DIR)/$$dest
endef
# chmod the file in its module
define chmod-module-file
dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \
$(CHMOD) $1 $(MODULE_DEST_DIR)/$$dest
endef
# install a sym link in its module
define install-module-sym-link
dest=`echo $@ | $(SED) $(MODULE_PATH_PATTERN)` ; \
$(LN) -sf $1 $(MODULE_DEST_DIR)/$$dest
endef
# Run MAKE $@ for a launcher:
# $(call make-launcher, name, mainclass, java-args, main-args)
define make-launcher
$(CD) $(BUILDDIR)/launchers && \
$(MAKE) -f Makefile.launcher \
MODULE=$(MODULE) \
PROGRAM=$(strip $1) \
MAIN_CLASS=$(strip $2) \
MAIN_JAVA_ARGS="$(strip $3)" \
@ -488,28 +430,18 @@ endef
define install-file
$(prep-target)
$(CP) $< $@
@$(install-module-file)
endef
define chmod-file
$(CHMOD) $1 $@
@$(call chmod-module-file, $1)
endef
define install-sym-link
$(LN) -s $1 $@
@$(call install-module-sym-link, $1)
endef
#
# Marcos for files not belonging to any module
define install-non-module-file
$(prep-target)
$(CP) $< $@
endef
define install-manifest-file
$(install-non-module-file)
$(install-file)
endef
# Cleanup rule for after debug java run (hotspot.log file is left around)
@ -577,7 +509,6 @@ endef
define install-import-file
$(install-importonly-file)
@$(install-module-file)
endef
.PHONY: all build clean clobber

View File

@ -25,8 +25,6 @@
# JDK Demo building jar file.
MODULE = demos
# Some names are defined with LIBRARY inside the Defs.gmk file
LIBRARY=$(DEMONAME)
OBJDIR=$(TEMPDIR)/$(DEMONAME)

View File

@ -168,18 +168,9 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf
$(OTHER_LCF) $(JAVALIB) $(LDLIBS)
$(CP) $(OBJDIR)/$(@F) $@
@$(call binary_file_verification,$@)
$(install-module-file)
$(CP) $(OBJDIR)/$(LIBRARY).map $(@D)
$(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D)
$(ACTUAL_LIBRARY):: $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).map $(ACTUAL_LIBRARY_DIR)/$(LIBRARY).pdb
$(ACTUAL_LIBRARY_DIR)/%.map: FORCE
$(install-module-file)
$(ACTUAL_LIBRARY_DIR)/%.pdb: FORCE
$(install-module-file)
endif # LIBRARY
$(OBJDIR)/$(LIBRARY).lcf: $(OBJDIR)/$(LIBRARY).res $(COMPILE_FILES_o) $(FILES_m)
@ -235,7 +226,6 @@ ifeq ($(LIBRARY), fdlibm)
else # LIBRARY
$(LINKER) $(SHARED_LIBRARY_FLAG) -o $@ $(FILES_o) $(LDLIBS)
@$(call binary_file_verification,$@)
$(install-module-file)
ifeq ($(WRITE_LIBVERSION),true)
$(MCS) -d -a "$(FULL_VERSION)" $@
endif # WRITE_LIBVERSION

View File

@ -1,454 +0,0 @@
#
# Copyright (c) 2009, 2010, 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.
#
JDK_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jdk-module-image
JRE_MODULE_IMAGE_DIR = $(ABS_OUTPUTDIR)/jre-module-image
#
# modules Target to build jdk and jre module image
#
# There is one jar file per module containing classes only.
# All module jars are currently placed under jre/lib directory.
#
# Open issues that need further investigation:
# 1. Classes in jre/lib/ext/dnsns.jar are currently put in jre/lib/jndi-dns
# module. META-INF/services file is not installed.
# 2. Signed jars
# For JDK build, signed jars are copied to the build.
# All jars in the module image are unsigned.
MODULE_IMAGEBINDIR = bin
#
# Targets.
#
INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre
INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk
ifeq ($(PLATFORM), solaris)
ifeq ($(ARCH_DATA_MODEL), 64)
INITIAL_MODULE_IMAGE_JRE=initial-module-image-jre-sol64
INITIAL_MODULE_IMAGE_JDK=initial-module-image-jdk-sol64
endif
endif
modules modules-clobber \
initial-module-image-jre initial-module-image-jdk \
initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
trim-module-image-jre trim-module-image-jdk \
process-module-image-jre process-module-image-jdk ::
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
# Order is important here, trim jre after jdk image is created
modules:: gen-modules \
sanity-module-images post-sanity-module-images \
$(INITIAL_MODULE_IMAGE_JRE) $(INITIAL_MODULE_IMAGE_JDK) \
trim-module-image-jre trim-module-image-jdk \
process-module-image-jre process-module-image-jdk
# Don't use these
module-image-jre:: initial-module-image-jre trim-module-image-jre process-module-image-jre
module-image-jdk:: initial-module-image-jdk trim-module-image-jdk process-module-image-jdk
#
# Paths to these files we need
JDK_MODULE_DOCFILES = $(IMAGE_DOCLIST_JDK:%=$(JDK_MODULE_IMAGE_DIR)/%)
JRE_MODULE_DOCFILES = $(IMAGE_DOCLIST_JRE:%=$(JRE_MODULE_IMAGE_DIR)/%)
###### RULES
# JDK files
$(JDK_MODULE_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file)
# JRE files
$(JRE_MODULE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file)
ifeq ($(PLATFORM), windows)
$(JRE_MODULE_IMAGE_DIR)/README.txt: $(SHARE_JRE_DOC_SRC)/README
$(process-doc-file)
endif
######################################################
# JRE Image
######################################################
MODULES_LIST = $(MODULES_TEMPDIR)/classlist/modules.list
# Modules in the jre/lib/security directory
POLICY_MODULES = US_export_policy local_policy
# Modules in the modules/ext directory
EXT_MODULES = localedata security-sunec security-sunjce
# Build PKCS#11 on all platforms except 64-bit Windows.
PKCS11 = security-sunpkcs11
ifeq ($(ARCH_DATA_MODEL), 64)
ifeq ($(PLATFORM), windows)
PKCS11 =
endif
endif
EXT_MODULES += $(PKCS11)
# Build Microsoft CryptoAPI provider only on (non-64-bit) Windows platform.
ifeq ($(PLATFORM), windows)
ifneq ($(ARCH_DATA_MODEL), 64)
EXT_MODULES += security-sunmscapi
endif
endif
# Modules for JDK only
JDK_MODULES = tools
gen-modules:
$(CD) modules; $(MAKE) all
initial-module-image-jre-setup:
$(RM) -r $(JRE_MODULE_IMAGE_DIR)
$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)
# 64-bit solaris jre image contains only the 64-bit add-on files.
initial-module-image-jre-sol64:: initial-module-image-jre-setup
@# Use tar instead of cp to preserve the symbolic links
for dir in bin lib ; do \
( $(CD) $(OUTPUTDIR) && \
$(TAR) cf - `$(FIND) $$dir -name '$(ARCH)' -print` | \
($(CD) $(JRE_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
done
@# Remove some files from the jre area
for t in $(NOTJRETOOLS) ; do \
$(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
done
$(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl'`
$(RM) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl'`
# Construct an initial jre image (initial jdk jre) no trimming or stripping
initial-module-image-jre:: initial-module-image-jre-setup \
$(JRE_MODULE_DOCFILES) \
$(BUILDMETAINDEX_JARFILE)
@# Copy in bin directory
$(CD) $(OUTPUTDIR) && $(FIND) bin -depth | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
@# CTE plugin security change require new empty directory lib/applet
$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/applet
@# Copy files but not .jar in lib directory
$(CD) $(OUTPUTDIR) && $(FIND) lib -depth | $(EGREP) -v ".jar$$" | $(CPIO) -pdum $(JRE_MODULE_IMAGE_DIR)
@#
@# copy modules to jre/lib
@#
for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \
$(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib ; \
done
$(MKDIR) -p $(JRE_MODULE_IMAGE_DIR)/lib/ext
for m in $(EXT_MODULES) ; do \
$(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/ext ; \
done
for m in $(POLICY_MODULES) ; do \
$(MV) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar $(JRE_MODULE_IMAGE_DIR)/lib/security; \
done
@# Remove jdk modules
for m in $(JDK_MODULES) ; do \
$(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$$m.jar ; \
done
@# Make sure all directories are read/execute for everyone
$(CHMOD) a+rx `$(FIND) $(JRE_MODULE_IMAGE_DIR) -type d`
@# Remove some files from the jre area
for t in $(NOTJRETOOLS) ; do \
$(RM) $(JRE_MODULE_IMAGE_DIR)/bin$(ISA_DIR)/$$t ; \
done
@# Remove orb.idl and ir.idl from jre
$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'orb.idl' -exec $(RM) \{} \;
$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -name 'ir.idl' -exec $(RM) \{} \;
@# Generate meta-index to make boot and extension class loaders lazier
$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
$(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
-o meta-index *.jar
@$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && $(java-vm-cleanup)
$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && \
$(BOOT_JAVA_CMD) -jar $(BUILDMETAINDEX_JARFILE) \
-o meta-index *.jar
@$(CD) $(JRE_MODULE_IMAGE_DIR)/lib/ext && $(java-vm-cleanup)
ifeq ($(PLATFORM), windows)
@# Remove certain *.lib files
$(CD) $(JRE_MODULE_IMAGE_DIR)/lib && \
$(RM) java.$(LIB_SUFFIX) jvm.$(LIB_SUFFIX) \
awt.$(LIB_SUFFIX) jawt.$(LIB_SUFFIX)
ifeq ($(ARCH_DATA_MODEL), 32)
@# The Java Kernel JRE image ships with a special VM. It is not included
@# in the full JRE image, so remove it. Also, is it only for 32-bit windows.
$(CD) $(JRE_MODULE_IMAGE_DIR)/bin && $(RM) -r kernel
endif
endif # Windows
ifneq ($(PLATFORM), windows)
$(call copy-man-pages,$(JRE_MODULE_IMAGE_DIR),$(JRE_MAN_PAGES))
endif # !windows
# Trim out any extra files not for the jre shipment but wanted in the jdk jre.
# (Note the jdk WILL want the jre image before this trimming)
# Removes server VM on Windows 32bit.
# Remove certain shared libraries that should not be in the jre image
# but should be in the jdk jre image.
trim-module-image-jre::
ifeq ($(PLATFORM), windows)
ifeq ($(ARCH_DATA_MODEL), 32)
$(RM) -r $(JRE_MODULE_IMAGE_DIR)/bin/server
endif
ifdef NOTJRE_SHARED_LIBS
for l in $(NOTJRE_SHARED_LIBS) ; do \
$(RM) $(JRE_MODULE_IMAGE_DIR)/bin/$$l ; \
done ;
endif
else # PLATFORM
ifdef NOTJRE_SHARED_LIBS
for l in $(NOTJRE_SHARED_LIBS) ; do \
$(RM) $(JRE_MODULE_IMAGE_DIR)/lib/$(LIBARCH)/$$l ; \
done ;
endif
endif # PLATFORM
# Get list of all Elf files in the jre
JRE_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jre-elf-files.list
$(JRE_MODULE_ELF_LIST):
@$(prep-target)
ifneq ($(PLATFORM), windows)
$(RM) $@
$(FIND) $(JRE_MODULE_IMAGE_DIR)/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JRE_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
endif
# Post process the image (strips and mcs on Elf files we are shipping)
# (Note the jdk WILL want the jre image before this processing)
process-module-image-jre:: $(JRE_MODULE_ELF_LIST)
ifneq ($(POST_STRIP_PROCESS), )
for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
$(CHMOD) u+w $${f}; \
$(ECHO) $(POST_STRIP_PROCESS) $${f}; \
$(POST_STRIP_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \
done
endif
ifneq ($(POST_MCS_PROCESS), )
for f in `$(CAT) $(JRE_MODULE_ELF_LIST)`; do \
$(CHMOD) u+w $${f}; \
$(ECHO) $(POST_MCS_PROCESS) $${f}; \
$(POST_MCS_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \
done
endif
$(RM) $(JRE_MODULE_ELF_LIST)
######################################################
# JDK Image
######################################################
# Note: cpio ($(CPIO)) sometimes leaves directories without rx access.
initial-module-image-jdk-setup:
$(RM) -r $(JDK_MODULE_IMAGE_DIR)
$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/jre
($(CD) $(JRE_MODULE_IMAGE_DIR) && $(FIND) . -depth -print \
| $(CPIO) -pdum $(JDK_MODULE_IMAGE_DIR)/jre )
$(RM) -rf $(JDK_MODULE_IMAGE_DIR)/jre/man
$(CHMOD) a+rx `$(FIND) $(JDK_MODULE_IMAGE_DIR) -type d`
initial-module-image-jdk64-bindemos:
for dir in bin demo ; do \
( $(CD) $(OUTPUTDIR) && \
$(TAR) cf - `$(FIND) $$dir -name '$(LIBARCH)' -print` | \
($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -) ) ; \
done
# Solaris 64 bit image is special
initial-module-image-jdk-sol64:: initial-module-image-jdk-setup \
initial-module-image-jdk64-bindemos
# DB files to add
ifeq ($(OPENJDK),true)
initial-module-image-jdk-db:
else
# Create the list of db *.zip files to bundle with jdk
ABS_DB_PATH :=$(call FullPath,$(CLOSED_SHARE_SRC)/db)
DB_ZIP_LIST = $(shell $(LS) $(ABS_DB_PATH)/*.zip 2>/dev/null)
initial-module-image-jdk-db: $(DB_ZIP_LIST)
$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/db
for d in $(DB_ZIP_LIST); do \
($(CD) $(JDK_MODULE_IMAGE_DIR)/db && $(UNZIP) -o $$d); \
done
endif
# Standard jdk image
initial-module-image-jdk:: initial-module-image-jdk-setup \
initial-module-image-jdk-db \
$(JDK_MODULE_DOCFILES)
$(MKDIR) $(JDK_MODULE_IMAGE_DIR)/lib
@#
@# copy jdk modules to jdk/lib
@#
$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/lib
for m in $(JDK_MODULES) ; do \
$(CP) $(MODULES_DIR)/$$m/lib/$$m.jar $(JDK_MODULE_IMAGE_DIR)/lib ; \
done
ifeq ($(PLATFORM), windows)
@#
@# lib/
@#
$(CP) $(LIBDIR)/$(LIB_PREFIX)jvm.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
$(CP) $(LIBDIR)/$(LIB_PREFIX)jawt.$(LIB_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/lib
@#
@# bin/
@#
@# copy all EXE files and only certain DLL files from BINDIR
$(MKDIR) -p $(JDK_MODULE_IMAGE_DIR)/bin
$(CP) $(BINDIR)/*$(EXE_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
$(CP) $(BINDIR)/jli.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
ifeq ($(COMPILER_VERSION), VS2010)
$(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
endif
ifeq ($(ARCH_DATA_MODEL), 32)
ifeq ($(COMPILER_VERSION), VS2003)
$(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_MODULE_IMAGE_DIR)/bin
endif
endif
else # PLATFORM
@#
@# bin/
@#
($(CD) $(BINDIR)/.. && $(TAR) cf - \
`$(FIND) bin \( -type f -o -type l \) -print `) | \
($(CD) $(JDK_MODULE_IMAGE_DIR) && $(TAR) xf -)
endif # PLATFORM
@#
@# lib/ct.sym
@#
$(MKDIR) -p $(OUTPUTDIR)/symbols/META-INF/sym
$(JAVAC_CMD) -XDprocess.packages -proc:only \
-processor com.sun.tools.javac.sym.CreateSymbols \
-Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
-Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
$(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS)
$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
-C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup)
$(CP) $(LIBDIR)/ct.sym $(JDK_MODULE_IMAGE_DIR)/lib/ct.sym
@#
@# CORBA supported orb.idl and ir.idl should be copied to lib
@#
$(CP) $(LIBDIR)/orb.idl $(JDK_MODULE_IMAGE_DIR)/lib/orb.idl
$(CP) $(LIBDIR)/ir.idl $(JDK_MODULE_IMAGE_DIR)/lib/ir.idl
ifeq ($(PLATFORM), linux)
@#
@# on Linux copy jexec from jre/lib to /lib
@#
$(CP) $(LIBDIR)/jexec $(JDK_MODULE_IMAGE_DIR)/lib/jexec
endif # PLATFORM
@#
@# demo, include
@#
$(CP) -r -f $(DEMODIR) $(JDK_MODULE_IMAGE_DIR)
$(CP) -r -f $(SAMPLEDIR) $(JDK_MODULE_IMAGE_DIR)
$(CP) -r $(INCLUDEDIR) $(JDK_MODULE_IMAGE_DIR)
@#
@# Swing BeanInfo generation
@#
$(CD) javax/swing/beaninfo && $(MAKE) JDK_IMAGE_DIR=$(JDK_MODULE_IMAGE_DIR) swing-1.2-beans
ifneq ($(PLATFORM), windows)
$(call copy-man-pages,$(JDK_MODULE_IMAGE_DIR),$(JDK_MAN_PAGES))
endif # !windows
# Trim out files we don't want to ship
trim-module-image-jdk::
@# Remove tools that should not be part of SDK.
for t in $(NOTJDKTOOLS); do \
$(RM) $(JDK_MODULE_IMAGE_DIR)/bin/$${t}$(EXE_SUFFIX); \
done
# Get list of Elf files in the jdk
JDK_MODULE_ELF_LIST=$(MODULES_TEMPDIR)/jdk-elf-files.list
$(JDK_MODULE_ELF_LIST):
@$(prep-target)
ifneq ($(PLATFORM), windows)
$(RM) $@
$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/lib -type f -name \*.$(LIB_SUFFIX) >> $@
$(FILE) `$(FIND) $(JDK_MODULE_IMAGE_DIR)/jre/bin -type f -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
file `$(FIND) $(JDK_MODULE_IMAGE_DIR)/bin -type f -name \*$(EXE_SUFFIX)` \
| $(EGREP) 'ELF' | $(CUT) -d':' -f1 >> $@
endif
# Post process the image (strips and mcs on files we are shipping)
process-module-image-jdk:: $(JDK_MODULE_ELF_LIST)
ifneq ($(POST_STRIP_PROCESS), )
for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
$(CHMOD) u+w $${f}; \
$(ECHO) $(POST_STRIP_PROCESS) $${f}; \
$(POST_STRIP_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \
done
endif
ifneq ($(POST_MCS_PROCESS), )
for f in `$(CAT) $(JDK_MODULE_ELF_LIST)`; do \
$(CHMOD) u+w $${f}; \
$(ECHO) $(POST_MCS_PROCESS) $${f}; \
$(POST_MCS_PROCESS) $${f}; \
$(CHMOD) go-w $${f}; \
done
endif
$(RM) $(JDK_MODULE_ELF_LIST)
######################################################
# clobber
######################################################
modules-clobber::
$(RM) -r $(JDK_MODULE_IMAGE_DIR)
$(RM) -r $(JRE_MODULE_IMAGE_DIR)
#
# TODO - nop for now
sanity-module-images post-sanity-module-images:
modules modules-clobber::
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
@$(java-vm-cleanup)
.PHONY: modules module-image-jre module-image-jdk \
initial-module-image-jre initial-module-image-jdk \
initial-module-image-jre-sol64 initial-module-image-jdk-sol64 \
initial-module-image-jdk-setup \
initial-module-image-jdk-db \
initial-module-image-jdk64-bindemos \
initial-module-image-jre-setup \
trim-module-image-jre trim-module-image-jdk \
process-module-image-jre process-module-image-jdk \
install-previous-jre install-previous-jdk \
modules-clobber
# Force rule
FRC:

View File

@ -186,7 +186,6 @@ $(ACTUAL_PROGRAM):: $(FILES_o)
$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
$(FILES_o) $(THREADLIBS) $(LDLIBS)
@$(call binary_file_verification,$@)
$(install-module-file)
endif # PLATFORM

View File

@ -60,7 +60,7 @@ EXCLUDE_PROPWARN_PKGS += sun.dyn
#
# Include the exported private packages in ct.sym.
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 7).
# with a new module system (being discussed for JDK 8).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
com.oracle.net

View File

@ -71,8 +71,7 @@ sanity-base: pre-sanity \
sane-cacerts \
sane-ant_version \
sane-zip_version \
sane-msvcrt_path \
sane-build_modules
sane-msvcrt_path
# The rules sanity-* have a one-to-one correspondence with the major targets
# Each sanity-* rule should have no body to ensure that the post-sanity-* is the

View File

@ -40,9 +40,6 @@
#
# By default, subdirs specified in the SUBDIRS and all SUBDIRS_*
# variables will be built.
#
# BUILD_MODULES variable can be used to specify one or more groups
# to be built (BUILD_MODULES=all will build all groups).
#
# Variables of the currently supported groups are:
# SUBDIRS_desktop
@ -53,15 +50,12 @@
#
# Change to the above list also need to update
# make/common/shared/Sanity.gmk. NOTE: this list is subject
# to change till the JDK 7 SE profiles/modules are finalized.
# to change.
#
# Eventually we want to restructure the make directory
# according to these grouping (e.g. make/desktop/...) and
# the SUBDIRS_<group> variables would not be needed.
#
# To build the desktop and tools groups only, you can do:
# gnumake BUILD_MODULES="desktop tools" ...
#
# Iterate the subdirectories specified in $1.
# - cd into each subdir and make them
@ -96,77 +90,51 @@ endef
#
# Iterate the list specified in SUBDIRS_<group> only if
# SUBDIRS_<group> is set and <group> or "all" is specified
# in the BUILD_MODULES variable
# SUBDIRS_<group> is set.
#
ifdef SUBDIRS_desktop
ifneq (,$(findstring desktop, $(BUILD_MODULES)))
define subdirs-desktop-loop
@$(call subdirs-group-loop,SUBDIRS_desktop)
endef
else
define subdirs-desktop-loop
endef
endif
define subdirs-desktop-loop
@$(call subdirs-group-loop,SUBDIRS_desktop)
endef
else
define subdirs-desktop-loop
endef
endif # SUBDIRS_desktop
ifdef SUBDIRS_enterprise
ifneq (,$(findstring enterprise, $(BUILD_MODULES)))
define subdirs-enterprise-loop
@$(call subdirs-group-loop,SUBDIRS_enterprise)
endef
else
define subdirs-enterprise-loop
endef
endif
define subdirs-enterprise-loop
@$(call subdirs-group-loop,SUBDIRS_enterprise)
endef
else
define subdirs-enterprise-loop
endef
endif # SUBDIRS_enterprise
ifdef SUBDIRS_management
ifneq (,$(findstring management, $(BUILD_MODULES)))
define subdirs-management-loop
@$(call subdirs-group-loop,SUBDIRS_management)
endef
else
define subdirs-management-loop
endef
endif
define subdirs-management-loop
@$(call subdirs-group-loop,SUBDIRS_management)
endef
else
define subdirs-management-loop
endef
define subdirs-management-loop
endef
endif # SUBDIRS_management
ifdef SUBDIRS_misc
ifneq (,$(findstring misc, $(BUILD_MODULES)))
define subdirs-misc-loop
@$(call subdirs-group-loop,SUBDIRS_misc)
endef
else
define subdirs-misc-loop
endef
endif
define subdirs-misc-loop
@$(call subdirs-group-loop,SUBDIRS_misc)
endef
else
define subdirs-misc-loop
endef
define subdirs-misc-loop
endef
endif # SUBDIRS_misc
ifdef SUBDIRS_tools
ifneq (,$(findstring tools, $(BUILD_MODULES)))
define subdirs-tools-loop
@$(call subdirs-group-loop,SUBDIRS_tools)
endef
else
define subdirs-tools-loop
endef
endif
define subdirs-tools-loop
@$(call subdirs-group-loop,SUBDIRS_tools)
endef
else
define subdirs-tools-loop
endef
define subdirs-tools-loop
endef
endif # SUBDIRS_tools
#
@ -175,30 +143,6 @@ endif # SUBDIRS_tools
SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \
$(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools)
ifndef BUILD_MODULES
define SUBDIRS-loop
@$(call subdirs-group-loop,SUBDIRS_all)
endef
else
ifneq (,$(findstring all, $(BUILD_MODULES)))
define SUBDIRS-loop
@$(call subdirs-group-loop,SUBDIRS_all)
endef
else # BUILD_MODULES set
#
# Iterate SUBDIRS and the groups specified in BUILD_MODULES
#
define SUBDIRS-loop
@$(call subdirs-group-loop,SUBDIRS)
@$(subdirs-desktop-loop)
@$(subdirs-enterprise-loop)
@$(subdirs-management-loop)
@$(subdirs-misc-loop)
@$(subdirs-tools-loop)
endef
endif
endif # BUILD_MODULES

View File

@ -64,7 +64,7 @@ COPYRIGHT_SYMBOL = &\#x00a9;
# Macro to construct the copyright line
# (The GNU make 3.78.1 "if" conditional is broken, fixed in GNU make 3.81)
define CopyrightLine # optionalurl optionalfirstyear optionaladdress
$(if $(strip $1),<a href=\"$(strip $1)\">Copyright</a>,Copyright) \
$(if $(strip $1),<a href="$(strip $1)">Copyright</a>,Copyright) \
$(COPYRIGHT_SYMBOL) $(if $2,$2${COMMA},) $(COPYRIGHT_YEAR),\
$(FULL_COMPANY_NAME). $3 All rights reserved.
endef

View File

@ -113,7 +113,7 @@ ifeq ($(PLATFORM), linux)
ALSA_INCLUDE=/usr/include/alsa/version.h
ALSA_LIBRARY=/usr/lib/libasound.so
_ALSA_VERSION := $(shell $(EGREP) SND_LIB_VERSION_STR $(ALSA_INCLUDE) | \
$(SED) -e 's@.*\"\(.*\)\".*@\1@' )
$(SED) -e 's@.*"\(.*\)".*@\1@' )
ALSA_VERSION := $(call GetVersion,$(_ALSA_VERSION))
endif
@ -221,8 +221,7 @@ include $(JDK_MAKE_SHARED_DIR)/Sanity-Settings.gmk
sane-zip_version \
sane-unzip_version \
sane-msvcrt_path \
sane-freetype \
sane-build_modules
sane-freetype
######################################################
# check for COPYRIGHT_YEAR variable
@ -334,12 +333,12 @@ sane-locale:
ifneq ($(PLATFORM), windows)
@if [ "$(LC_ALL)" != "" -a "$(LC_ALL)" != "C" ]; then \
$(ECHO) "WARNING: LC_ALL has been set to $(LC_ALL), this can cause build failures. \n" \
" Try setting LC_ALL to \"C\". \n" \
" Try setting LC_ALL to 'C'. \n" \
"" >> $(WARNING_FILE) ; \
fi
@if [ "$(LANG)" != "" -a "$(LANG)" != "C" ]; then \
$(ECHO) "WARNING: LANG has been set to $(LANG), this can cause build failures. \n" \
" Try setting LANG to \"C\". \n" \
" Try setting LANG to 'C'. \n" \
"" >> $(WARNING_FILE) ; \
fi
endif
@ -831,21 +830,6 @@ else
sane-freetype:
endif
######################################################
# if specified, BUILD_MODULES must contain valid values.
######################################################
MODULES_REGEX="all|base|desktop|management|enterprise|misc|tools"
sane-build_modules:
ifdef BUILD_MODULES
@for m in $(BUILD_MODULES) ; do \
valid=`$(ECHO) $$m | $(EGREP) $(MODULES_REGEX)`; \
if [ "x$$valid" = "x" ] ; then \
$(ECHO) "ERROR: $$m set in the BUILD_MODULES variable is invalid.\n" \
"" >> $(ERROR_FILE); \
fi \
done
endif
######################################################
# CUPS_HEADERS_PATH must be valid
######################################################
@ -1126,7 +1110,7 @@ TMP_SDK_INCLUDE_GET_FULL_VERSION= $(TMP_SDK_INCLUDE_FIND_VERSION) | \
# be checked when this represents a full control build (i.e. the
# HOTSPOT_IMPORT_PATH includes these files in it's 'include' directory).
$(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
@$(install-non-module-file)
@$(install-file)
@$(RM) $@.IMPORT
@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(@F) ]; then \
$(CP) $(HOTSPOT_IMPORT_PATH)/include/$(@F) $@.IMPORT ; \
@ -1140,7 +1124,7 @@ $(TEMPDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
fi
$(TEMPDIR)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
@$(install-non-module-file)
@$(install-file)
@$(RM) $@.IMPORT
@if [ -r $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) ]; then \
$(CP) $(HOTSPOT_IMPORT_PATH)/include/$(PLATFORM_INCLUDE_NAME)/$(@F) $@.IMPORT ; \
@ -1343,9 +1327,9 @@ ifdef LINK_VER
fi
@if [ "$(LINK_CHECK)" != "same" ]; then \
$(ECHO) "WARNING: To build Java 2 SDK $(JDK_VERSION) you need : \n" \
" $(REQUIRED_COMPILER_VERSION) - link.exe version \"$(REQUIRED_LINK_VER)\" \n" \
" $(REQUIRED_COMPILER_VERSION) - link.exe version '$(REQUIRED_LINK_VER)' \n" \
" Specifically the $(REQUIRED_COMPILER_NAME) link.exe. \n " \
" $(YOU_ARE_USING) Linker version \"$(LINK_VER)\" \n" \
" $(YOU_ARE_USING) Linker version '$(LINK_VER)' \n" \
"" >> $(WARNING_FILE) ; \
fi
endif

View File

@ -43,7 +43,7 @@ COPYRIGHT_URL = $(COPYRIGHT_URL-$(JDK_MINOR_VERSION))
BUG_SUBMIT_URL = http://bugs.sun.com/services/bugreport/index.jsp
# Common line for how to submit a bug or rfe
BUG_SUBMIT_LINE = <a href=\"$(BUG_SUBMIT_URL)\">Submit a bug or feature</a>
BUG_SUBMIT_LINE = <a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a>
# Url to devdocs page
# Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
@ -166,21 +166,32 @@ JDKJRE2COREAPI = ../../api
# Common bottom argument
define CommonBottom # year
<font size=\"-1\"><br> $(call CopyrightLine,,$1,)</font>
<font size="-1"><br> $(call CopyrightLine,,$1,)</font>
endef
# Common trademark bottom argument (Not sure why this is used sometimes)
define CommonTrademarkBottom # year
<font size=\"-1\">\
<font size="-1">\
$(BUG_SUBMIT_LINE)<br>$(JAVA_TRADEMARK_LINE)<br>\
$(call CopyrightLine,,$1,$(COMPANY_ADDRESS))\
</font>
endef
# Common echo of option
define OptionOnly # opt
$(PRINTF) "%s\n" "$1"
endef
define OptionPair # opt arg
$(PRINTF) "%s '%s'\n" "$1" '$2'
endef
define OptionTrip # opt arg arg
$(PRINTF) "%s '%s' '%s'\n" "$1" '$2' '$3'
endef
# Core api bottom argument (with special sauce)
COREAPI_BOTTOM = <font size=\"-1\"> $(BUG_SUBMIT_LINE)\
COREAPI_BOTTOM = <font size="-1"> $(BUG_SUBMIT_LINE)\
<br>For further API reference and developer documentation, \
see <a href=\"$(DEV_DOCS_URL)\" target=\"_blank\">Java SE Documentation</a>. \
see <a href="$(DEV_DOCS_URL)" target="_blank">Java SE Documentation</a>. \
That documentation contains more detailed, developer-targeted descriptions, \
with conceptual overviews, definitions of terms, workarounds, \
and working code examples.<br>\
@ -212,11 +223,11 @@ ifeq ($(JDK_IS_FCS),false)
DRAFT_WINTITLE = $(BUILD_NUMBER)
# Early access top text (not used in FCS releases)
COREAPI_TOP_EARLYACCESS = \
<div style=\"background-color: \#EEEEEE\"> \
<div style=\"padding: 6px; margin-top: 2px; margin-bottom: 6px; \
<div style="background-color: \#EEEEEE"> \
<div style="padding: 6px; margin-top: 2px; margin-bottom: 6px; \
margin-left: 6px; margin-right: 6px; text-align: justify; \
font-size: 80%; font-family: Helvetica, Arial, sans-serif; \
font-weight: normal;\"> \
font-weight: normal;"> \
Please note that the specifications and other information \
contained herein are not final and are subject to change. \
The information is being made available to you solely for purpose of \
@ -281,15 +292,9 @@ COREAPI_WINDOWTITLE = Java Platform SE $(JDK_MINOR_VERSION)
COREAPI_HEADER = \
<strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
# Ignored tags
IGNORED_TAGS = beaninfo revised since.unbundled spec specdefault Note ToDo
# Java language specification cite
JLS3_CITE = <a href=\"$(JLS3_URL)\"> \
The Java Language Specification, Third Edition</a>
TAG_JLS3 = -tag 'jls3:a:See <cite>$(JLS3_CITE)</cite>:'
TAGS = $(IGNORED_TAGS:%=-tag %:X) $(TAG_JLS3)
TAG_JLS3 = jls3:a:See <cite><a href="$(JLS3_URL)"> \
The Java Language Specification, Third Edition</a></cite>:
# Overview file for core apis
COREAPI_OVERVIEW = $(SHARE_SRC)/classes/overview-core.html
@ -314,19 +319,26 @@ $(COREAPI_INDEX_FILE): $(COREAPI_OPTIONS_FILE) $(COREAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(COREAPI_OPTIONS_FILE): $(COREAPI_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "$(TAGS)" ; \
$(ECHO) "-encoding ISO-8859-1" ; \
$(ECHO) "-splitIndex" ; \
$(ECHO) "-overview $(COREAPI_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(COREAPI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(COREAPI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(COREAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ISO-8859-1) ; \
$(call OptionPair,-tag,beaninfo:X) ; \
$(call OptionPair,-tag,revised:X) ; \
$(call OptionPair,-tag,since.unbundled:X) ; \
$(call OptionPair,-tag,spec:X) ; \
$(call OptionPair,-tag,specdefault:X) ; \
$(call OptionPair,-tag,Note:X) ; \
$(call OptionPair,-tag,ToDo:X) ; \
$(call OptionPair,-tag,$(TAG_JLS3)) ; \
$(call OptionOnly,-splitIndex) ; \
$(call OptionPair,-overview,$(COREAPI_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(COREAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(COREAPI_WINDOWTITLE) $(DRAFT_WINTITLE)) ;\
$(call OptionPair,-header,$(COREAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(COREAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
) >> $@
ifdef COREAPI_TOP_EARLYACCESS
@$(ECHO) "-top '$(COREAPI_TOP_EARLYACCESS)'" >> $@
@$(call OptionPair,-top,$(COREAPI_TOP_EARLYACCESS)) >> $@
endif
# Create a file with the package names in it
@ -375,16 +387,16 @@ $(MIRROR_INDEX_FILE): $(MIRROR_OPTIONS_FILE) $(MIRROR_PACKAGES_FILE)
# Create file with javadoc options in it
$(MIRROR_OPTIONS_FILE): $(MIRROR_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-overview $(MIRROR_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(MIRROR_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(MIRROR_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-group $(MIRROR_GROUPNAME) $(MIRROR_REGEXP)" ; \
$(ECHO) "-linkoffline $(MIRROR2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionPair,-overview,$(MIRROR_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(MIRROR_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(MIRROR_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(MIRROR_GROUPNAME),$(MIRROR_REGEXP)); \
$(call OptionTrip,-linkoffline,$(MIRROR2COREAPI),$(COREAPI_DOCSDIR)); \
) >> $@
# Create a file with the package names in it
@ -432,16 +444,16 @@ $(DOCLETAPI_INDEX_FILE): $(DOCLETAPI_OPTIONS_FILE) $(DOCLETAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(DOCLETAPI_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-breakiterator" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-doctitle '$(DOCLETAPI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(DOCLETAPI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-group $(DOCLETAPI_GROUPNAME) $(DOCLETAPI_REGEXP)" ; \
$(ECHO) "-linkoffline $(DOCLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-breakiterator) ; \
$(call OptionPair,-doctitle,$(DOCLETAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(DOCLETAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(DOCLETAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(DOCLETAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(DOCLETAPI_GROUPNAME),$(DOCLETAPI_REGEXP)); \
$(call OptionTrip,-linkoffline,$(DOCLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -492,13 +504,13 @@ $(TAGLETAPI_INDEX_FILE): $(TAGLETAPI_OPTIONS_FILE) $(TAGLETAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(TAGLETAPI_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nonavbar" ; \
$(ECHO) "-noindex" ; \
$(ECHO) "-bottom '$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(TAGLETAPI2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nonavbar) ; \
$(call OptionOnly,-noindex) ; \
$(call OptionPair,-bottom,$(TAGLETAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(TAGLETAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -543,16 +555,16 @@ $(DOMAPI_INDEX_FILE): $(DOMAPI_OPTIONS_FILE) $(DOMAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(DOMAPI_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-splitIndex" ; \
$(ECHO) "-doctitle '$(DOMAPI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(DOMAPI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-group $(DOMAPI_GROUPNAME) $(DOMAPI_REGEXP)" ; \
$(ECHO) "-linkoffline $(DOMAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-splitIndex) ; \
$(call OptionPair,-doctitle,$(DOMAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(DOMAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(DOMAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(DOMAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(DOMAPI_GROUPNAME),$(DOMAPI_REGEXP)); \
$(call OptionTrip,-linkoffline,$(DOMAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -605,15 +617,15 @@ $(JDI_INDEX_FILE): $(JDI_OPTIONS_FILE) $(JDI_PACKAGES_FILE)
# Create file with javadoc options in it
$(JDI_OPTIONS_FILE): $(JDI_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-overview $(JDI_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(JDI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)'" ; \
$(ECHO) "-header '$(JDI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(JDI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(JDI2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionPair,-overview,$(JDI_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(JDI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(JDI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
$(call OptionPair,-header,$(JDI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(JDI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(JDI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -693,15 +705,15 @@ $(JAAS_INDEX_FILE): $(JAAS_OPTIONS_FILE) $(JAAS_PACKAGES_FILE)
# Create file with javadoc options in it
$(JAAS_OPTIONS_FILE): $(JAAS_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-overview $(JAAS_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(JAAS_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
$(ECHO) "-header '$(JAAS_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(JAAS_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(JAAS2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionPair,-overview,$(JAAS_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(JAAS_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(JAAS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
$(call OptionPair,-header,$(JAAS_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(JAAS_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(JAAS2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -745,16 +757,16 @@ $(JGSS_INDEX_FILE): $(JGSS_OPTIONS_FILE) $(JGSS_PACKAGES_FILE)
# Create file with javadoc options in it
$(JGSS_OPTIONS_FILE): $(JGSS_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-overview $(JGSS_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(JGSS_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
$(ECHO) "-header '$(JGSS_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(JGSS_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(JGSS2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-overview,$(JGSS_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(JGSS_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(JGSS_WINDOWTITLE) $(DRAFT_WINTITLE)); \
$(call OptionPair,-header,$(JGSS_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(JGSS_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(JGSS2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -797,15 +809,15 @@ $(SMARTCARDIO_INDEX_FILE): $(SMARTCARDIO_OPTIONS_FILE) $(SMARTCARDIO_PACKAGES_FI
# Create file with javadoc options in it
$(SMARTCARDIO_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(SMARTCARDIO_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(SMARTCARDIO2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(SMARTCARDIO_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(SMARTCARDIO_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(SMARTCARDIO_HEADER)$(DRAFT_HEADER)); \
$(call OptionPair,-bottom,$(SMARTCARDIO_BOTTOM)$(DRAFT_BOTTOM)); \
$(call OptionTrip,-linkoffline,$(SMARTCARDIO2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -847,15 +859,15 @@ $(HTTPSERVER_INDEX_HTML): $(HTTPSERVER_OPTIONS_FILE) $(HTTPSERVER_PACKAGES_FILE)
# Create file with javadoc options in it
$(HTTPSERVER_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(HTTPSERVER_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(HTTPSERVER_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(HTTPSERVER2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(HTTPSERVER_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(HTTPSERVER_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(HTTPSERVER_HEADER)$(DRAFT_HEADER)); \
$(call OptionPair,-bottom,$(HTTPSERVER_BOTTOM)$(DRAFT_BOTTOM)); \
$(call OptionTrip,-linkoffline,$(HTTPSERVER2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -907,16 +919,16 @@ $(MGMT_INDEX_FILE): $(MGMT_OPTIONS_FILE) $(MGMT_PACKAGES_FILE)
# Create file with javadoc options in it
$(MGMT_OPTIONS_FILE): $(MGMT_OVERVIEW)
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-overview $(MGMT_OVERVIEW)" ; \
$(ECHO) "-doctitle '$(MGMT_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)'"; \
$(ECHO) "-header '$(MGMT_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(MGMT_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(MGMT2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-overview,$(MGMT_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(MGMT_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(MGMT_WINDOWTITLE) $(DRAFT_WINTITLE)); \
$(call OptionPair,-header,$(MGMT_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(MGMT_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(MGMT2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -958,15 +970,15 @@ $(ATTACH_INDEX_HTML): $(ATTACH_OPTIONS_FILE) $(ATTACH_PACKAGES_FILE)
# Create file with javadoc options in it
$(ATTACH_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(ATTACH_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(ATTACH_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(ATTACH_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(ATTACH2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(ATTACH_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(ATTACH_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(ATTACH_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(ATTACH_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(ATTACH2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -1008,15 +1020,15 @@ $(JCONSOLE_INDEX_HTML): $(JCONSOLE_OPTIONS_FILE) $(JCONSOLE_PACKAGES_FILE)
# Create file with javadoc options in it
$(JCONSOLE_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(JCONSOLE_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(JCONSOLE_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(JCONSOLE2COREAPI) $(COREAPI_DOCSDIR)/"; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(JCONSOLE_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(JCONSOLE_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(JCONSOLE_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(JCONSOLE_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(JCONSOLE2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -1063,15 +1075,15 @@ $(TREEAPI_INDEX_HTML): $(TREEAPI_OPTIONS_FILE) $(TREEAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(TREEAPI_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-doctitle '$(TREEAPI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(TREEAPI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-group $(TREEAPI_GROUPNAME) $(TREEAPI_REGEXP)" ; \
$(ECHO) "-linkoffline $(TREEAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionPair,-doctitle,$(TREEAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(TREEAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(TREEAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(TREEAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(TREEAPI_GROUPNAME),$(TREEAPI_REGEXP)); \
$(call OptionTrip,-linkoffline,$(TREEAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -1113,15 +1125,15 @@ $(SCTPAPI_INDEX_HTML): $(SCTPAPI_OPTIONS_FILE) $(SCTPAPI_PACKAGES_FILE)
# Create file with javadoc options in it
$(SCTPAPI_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(SCTPAPI_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(SCTPAPI_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(SCTPAPI2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(SCTPAPI_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(SCTPAPI_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(SCTPAPI_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(SCTPAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(SCTPAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it
@ -1163,15 +1175,15 @@ $(TRACING_INDEX_HTML): $(TRACING_OPTIONS_FILE) $(TRACING_PACKAGES_FILE)
# Create file with javadoc options in it
$(TRACING_OPTIONS_FILE):
$(prep-target)
@($(ECHO) "$(COMMON_JAVADOCFLAGS)" ; \
$(ECHO) "-sourcepath \"$(RELEASEDOCS_SOURCEPATH)\"" ; \
$(ECHO) "-encoding ascii" ; \
$(ECHO) "-nodeprecatedlist" ; \
$(ECHO) "-doctitle '$(TRACING_DOCTITLE)'" ; \
$(ECHO) "-windowtitle '$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE)'";\
$(ECHO) "-header '$(TRACING_HEADER)$(DRAFT_HEADER)'" ; \
$(ECHO) "-bottom '$(TRACING_BOTTOM)$(DRAFT_BOTTOM)'" ; \
$(ECHO) "-linkoffline $(TRACING2COREAPI) $(COREAPI_DOCSDIR)/" ; \
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionOnly,-nodeprecatedlist) ; \
$(call OptionPair,-doctitle,$(TRACING_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(TRACING_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(TRACING_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(TRACING_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-linkoffline,$(TRACING2COREAPI),$(COREAPI_DOCSDIR)/); \
) >> $@
# Create a file with the package names in it

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = awt
PACKAGE = java.awt
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -31,7 +31,6 @@
#
BUILDDIR = ../..
MODULE = base
LIBRARY = fdlibm
PRODUCT = java

View File

@ -27,7 +27,6 @@
# agent, supporting java.lang.instrument
BUILDDIR = ../..
MODULE = instrument
PACKAGE = sun.instrument
LIBRARY = instrument
PRODUCT = sun

View File

@ -29,7 +29,6 @@
#
BUILDDIR = ../..
MODULE = base
PACKAGE = java.lang
LIBRARY = java
PRODUCT = java
@ -244,7 +243,7 @@ ifneq ($(PLATFORM),windows)
$(GENSRCDIR)/java/lang/UNIXProcess.java: \
$(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM)
$(install-non-module-file)
$(install-file)
clean::
$(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java
@ -318,7 +317,6 @@ $(CURDATA): \
$(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \
< $(SHARE_SRC)/classes/java/util/CurrencyData.properties
$(MV) $@.temp $@
$(install-module-file)
$(call chmod-file, 444)
clean::
@ -373,7 +371,7 @@ $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \
-usecharforbyte 11 4 1
$(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template
$(install-non-module-file)
$(install-file)
clean::
$(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java

View File

@ -25,7 +25,6 @@
BUILDDIR = ../..
MODULE = demos
LIBRARY = java_crw_demo
PRODUCT = sun
LIBRARY_OUTPUT = java_crw_demo

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = instrument
LIBRARY = hprof
PRODUCT = sun
LIBRARY_OUTPUT = hprof_jvmti

View File

@ -30,7 +30,6 @@
# its manifestations (java, javaw, javac, ...).
#
BUILDDIR = ../..
MODULE = base
LIBRARY = jli
PRODUCT = java

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = base
include $(BUILDDIR)/common/Defs.gmk
@ -39,10 +38,10 @@ FILES_h = $(INCLUDEDIR)/jni.h \
$(INCLUDEDIR)/classfile_constants.h
$(INCLUDEDIR)/%.h: $(SHARE_SRC)/javavm/export/%.h
$(install-non-module-file)
$(install-file)
$(PLATFORM_INCLUDE)/%.h: $(PLATFORM_SRC)/javavm/export/%.h
$(install-non-module-file)
$(install-file)
JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = logging
PACKAGE = java.util.logging
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = base
PROGRAM = java
PRODUCT = java

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../..
MODULE = base
PROGRAM = javaw
PRODUCT = java

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = management
PACKAGE = java.lang.management
LIBRARY = management
PRODUCT = java

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = base
PACKAGE = java.net
LIBRARY = net
PRODUCT = sun

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = nio
PACKAGE = java.nio
LIBRARY = nio
PRODUCT = java
@ -304,11 +303,7 @@ endif # PLATFORM
# Rules
#
SUBDIRS_management = mxbean
include $(BUILDDIR)/common/Subdirs.gmk
build: sources
$(SUBDIRS-loop)
clean clobber::
$(RM) -r $(NIO_GEN) $(SNIO_GEN)
@ -821,7 +816,7 @@ SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSOR_SRC) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
$(TEMPDIR)/$(GENSOR_SRC) : $(GENSOR_SRC)
$(install-non-module-file)
$(install-file)
$(GENSOR_EXE) : $(TEMPDIR)/$(GENSOR_SRC)
$(prep-target)

View File

@ -1,34 +0,0 @@
#
# Copyright (c) 2010, 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.
#
BUILDDIR = ../../..
MODULE = management
PACKAGE = java.nio
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
FILES_java = java/nio/BufferPoolMXBean.java
include $(BUILDDIR)/common/Classes.gmk

View File

@ -26,7 +26,6 @@
BUILDDIR = ../..
# It's currently used by jpda and hprof. Put it in base module for now.
MODULE = base
LIBRARY = npt
PRODUCT = sun
LIBRARY_OUTPUT = npt

View File

@ -35,7 +35,6 @@
#
BUILDDIR = ../..
MODULE = base
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk
@ -122,32 +121,26 @@ $(LIBDIR)/$(JVMLIB_NAME): $(HOTSPOT_LIB_PATH)/$(JVMLIB_NAME)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMMAP_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMMAP_NAME) $@
@$(install-module-file)
$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMMAP_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMMAP_NAME) $@
@$(install-module-file)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMMAP_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMMAP_NAME) $@
@$(install-module-file)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMPDB_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_CLIENT_PATH)/$(JVMPDB_NAME) $@
@$(install-module-file)
$(LIB_LOCATION)/$(KERNEL_LOCATION)/$(JVMPDB_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_KERNEL_PATH)/$(JVMPDB_NAME) $@
@$(install-module-file)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMPDB_NAME):
@$(prep-target)
-$(CP) $(HOTSPOT_SERVER_PATH)/$(JVMPDB_NAME) $@
@$(install-module-file)
# Windows ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Windows
else # PLATFORM
@ -291,7 +284,7 @@ INTERNAL_IMPORT_LIST += \
$(LIBDIR)/jce.jar: \
$(BUILDDIR)/closed/tools/crypto/jce/jce.jar
$(install-non-module-file)
$(install-file)
$(LIBDIR)/security/US_export_policy.jar: \
$(BUILDDIR)/closed/tools/crypto/jce/US_export_policy.jar
$(install-file)

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = font
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = sajdi
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = base
PACKAGE = java.security
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = jdbc-base
PACKAGE = java.sql
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = base
PACKAGE = java.text
PRODUCT = sun

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = base
PRODUCT = java
LIBRARY = verify
include $(BUILDDIR)/common/Defs.gmk

View File

@ -25,7 +25,6 @@
BUILDDIR = ../..
MODULE = base
PACKAGE = java.util.zip
LIBRARY = zip
PRODUCT = sun

View File

@ -83,7 +83,7 @@ RELEASE_DIR = $(OUTPUTDIR)/jce-release
define release-warning
@$(ECHO) \
"\n***The jar files built by the \"release\" target must***" \
"\n***The jar files built by the 'release' target must***" \
"\n***still be checked into the closed workspace! ***" \
$(README-MAKEFILE_WARNING)
endef

View File

@ -108,7 +108,6 @@
#
BUILDDIR = ../..
MODULE = base
PACKAGE = javax.crypto
PRODUCT = sun
@ -294,7 +293,7 @@ limited: \
$(UNSIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar: \
$(UNSIGNED_POLICY_BUILDDIR)/unlimited/US_export_policy.jar
$(install-non-module-file)
$(install-file)
$(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar: \
policy/limited/default_local.policy \
@ -415,7 +414,7 @@ $(JAR_DESTFILE): $(UNSIGNED_DIR)/jce.jar
else
$(JAR_DESTFILE): $(SIGNED_DIR)/jce.jar
endif
$(install-non-module-file)
$(install-file)
#
# Install the appropriate policy file, depending on the type of build.
@ -435,7 +434,7 @@ install-limited-jars: \
$(POLICY_DESTDIR)/local_policy.jar
$(CP) $^ $(POLICY_DESTDIR)
install-limited: install-limited-jars install-module-files
install-limited: install-limited-jars
ifndef OPENJDK
$(release-warning)
endif
@ -449,7 +448,7 @@ install-unlimited-jars: \
$(POLICY_DESTDIR)/local_policy.jar
$(CP) $^ $(POLICY_DESTDIR)
install-unlimited: install-unlimited-jars install-module-files
install-unlimited: install-unlimited-jars
ifndef OPENJDK
$(release-warning)
endif
@ -466,16 +465,9 @@ install-prebuilt-jars:
$(PREBUILT_DIR)/jce/local_policy.jar \
$(POLICY_DESTDIR)
install-prebuilt: install-prebuilt-jars install-module-files
install-prebuilt: install-prebuilt-jars
endif
install-module-files: \
$(POLICY_DESTDIR)/US_export_policy.jar \
$(POLICY_DESTDIR)/local_policy.jar
$(POLICY_DESTDIR)/%.jar :
$(install-module-file)
# =====================================================
# Support routines.
#

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = imageio
PACKAGE = javax.imageio
PRODUCT = jiio
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = print
PACKAGE = javax.print
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = sound
PACKAGE = javax.sound
LIBRARY = jsound
PRODUCT = sun

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = sound
PACKAGE = javax.sound
LIBRARY = jsoundalsa
PRODUCT = sun

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = sound
PACKAGE = javax.sound
LIBRARY = jsoundds
PRODUCT = sun

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = jdbc-enterprise
PACKAGE = javax.sql
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../..
MODULE = swing
PACKAGE = javax.swing
PRODUCT = com
SWING_SRC = $(SHARE_SRC)/classes/javax/swing

View File

@ -24,7 +24,6 @@
#
BUILDDIR = ../../..
MODULE = swing
PACKAGE = javax.swing.plaf
PRODUCT = com
SWING_SRC = $(SHARE_SRC)/classes/javax/swing

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = debugging
LIBRARY = jdwp
PRODUCT = jpda

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = debugging
PRODUCT = jpda
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../..
MODULE = debugging
LIBRARY = dt_shmem
PRODUCT = jbug

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../../..
MODULE = debugging
LIBRARY = dt_socket
PRODUCT = jbug

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = jdb
PACKAGE = com.sun.tools.example.debug.tty
PRODUCT = jpda
PROGRAM = jdb

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ..
MODULE = tools
PACKAGE = launchers
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
@ -38,7 +37,6 @@ include $(BUILDDIR)/common/Defs.gmk
define make-corba-launcher
$(CD) $(BUILDDIR)/launchers && \
$(MAKE) -f Makefile.launcher \
MODULE=corba \
PROGRAM=$(strip $1) \
MAIN_CLASS=$(strip $2) \
MAIN_JAVA_ARGS="$(strip $3)" \

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = demos
PRODUCT = demos
include $(BUILDDIR)/common/Defs.gmk

View File

@ -28,7 +28,6 @@
#
BUILDDIR = ../..
MODULE = demos
PRODUCT = demos
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -29,7 +29,6 @@
BUILDDIR = ../../..
MODULE = samples
PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk

View File

@ -1,134 +0,0 @@
#
# Copyright (c) 2009, 2010, 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.
#
BUILDDIR = ..
include $(BUILDDIR)/common/Defs.gmk
#
# Modularizing the JDK
# - Post jdk build process until the source tree is restructured
# for modules build
# - <outputdir>/modules/<module> will be created for each module.
#
# Steps:
# 0. During jdk build before this makefile is invoked, classes,
# resource files, and other non-class files such as native libraries,
# properties file, images, etc are created.
#
# Non-class files are copied to <outputdir>/tmp/modules/<MODULE>
# directory in this step to prepare for the post-build modularization.
#
# The MODULE variable defined in other makefiles specifies
# the lowest-level module that the non-class files belong to.
# The name might or might not be the same as the name of the modules
# in the resulting <outputdir>/modules directory.
#
# 1. Unpack all jars in the <builddir>/lib directory to a temporary
# location (<outputdir>/tmp/modules/classes) to prepare for modules
# creation.
#
# 2. Run ClassAnalyzer tool to analyze all jdk classes and generate
# class list for all modules and also perform dependency analysis.
#
# Input configuration files :-
#
# modules.config : defines the low-level modules and specifies
# what classes and resource files each module includes.
# modules.group : defines the module groups and its members.
# jdk7.depconfig : lists the dynamic dependencies including
# use of reflection Class.forName and JNI FindClass and
# service provider.
# optional.depconfig : lists the optional dependencies
#
# 3. Create one directory for each module (<outputdir>/modules/<module>)
# based on the output files from (2).
#
# modules.list lists the modules to be created for the modules
# build and its members. For each module (m) in modules.list,
# a. create $m/lib/$m.jar with all classes and resource files
# listed in $m.classlist and $m.resources respectively.
# b. copy all non-class files from its members to
# <outputdir>/modules/$m.
MAINMANIFEST=$(JDK_TOPDIR)/make/tools/manifest.mf
MODULE_JAR_MANIFEST_FILE=$(ABS_TEMPDIR)/manifest.tmp
TMP = $(ABS_MODULES_TEMPDIR)
MODULE_CLASSLIST = $(ABS_MODULES_TEMPDIR)/classlist
MODULE_CLASSES = $(ABS_MODULES_TEMPDIR)/classes
MODULES_LIST = $(MODULE_CLASSLIST)/modules.list
all:: unpack-jars gen-classlist modularize
JAR_LIST := $(shell $(FIND) $(ABS_OUTPUTDIR)/lib -name \*.jar -print)
unpack-jars:
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
$(RM) -rf $(MODULE_CLASSES)
$(MKDIR) -p $(MODULE_CLASSES)
$(CP) -rf $(CLASSBINDIR)/* $(MODULE_CLASSES)
@for jf in $(JAR_LIST) ; do \
$(CD) $(MODULE_CLASSES) && $(BOOT_JAR_CMD) xf $$jf $(BOOT_JAR_JFLAGS);\
done
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
gen-classlist:
$(CD) tools && $(MAKE) all
modularize: $(MODULE_JAR_MANIFEST_FILE)
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
@$(RM) -rf $(MODULES_DIR)
@# create jar file for modules and
@# copy other files from all members of this module
for m in `$(NAWK) '{print $$1}' $(MODULES_LIST)` ; do \
$(ECHO) "Creating module $$m" ; \
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.classlist > $(TMP)/tmp.cf ; \
if [ -f $(MODULE_CLASSLIST)/$$m.resources ] ; then \
$(SED) -e 's%\\%\/%g' < $(MODULE_CLASSLIST)/$$m.resources >> $(TMP)/tmp.cf ; \
fi ; \
$(MKDIR) -p $(ABS_MODULES_DIR)/$$m/lib; \
$(CD) $(MODULE_CLASSES) && \
$(BOOT_JAR_CMD) c0mf $(MODULE_JAR_MANIFEST_FILE) \
$(ABS_MODULES_DIR)/$$m/lib/$$m.jar \
@$(TMP)/tmp.cf \
$(BOOT_JAR_JFLAGS); \
for s in `$(GREP) "^$$m" $(MODULES_LIST)` ; do \
if [ -d $(TMP)/$$s ] ; then \
$(CP) -rf $(TMP)/$$s/* $(ABS_MODULES_DIR)/$$m; \
$(RM) -rf $(ABS_MODULES_DIR)/$$m/classes; \
fi \
done \
done
@$(CD) $(MODULE_CLASSES) && $(java-vm-cleanup)
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
$(MODULE_JAR_MANIFEST_FILE):
$(SED) -e "s/@@RELEASE@@/$(RELEASE)/" $(MAINMANIFEST) > $@
clean clobber::
$(RM) -rf $(MODULE_CLASSLIST)
$(RM) -rf $(MODULES_DIR)
$(RM) $(MODULE_JAR_MANIFEST_FILE)

View File

@ -1,199 +0,0 @@
#
# Copyright (c) 2009, 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.
#
# 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.
#
#
# List of root classes/methods, each line of the following syntax:
# <class name>
# <method name> <signature>|*
# exclude <class>|<method>
# The boot module generated based on this rootset does not support
# - security permission check
# - non-standard charset
# - logging output
# - resource bundles
# including error output from the launcher
# VM preloaded classes
java.lang.Object
java.lang.String
java.lang.Class
java.lang.Cloneable
java.lang.ClassLoader
java.lang.System
java.lang.Throwable
java.lang.Error
java.lang.ThreadDeath
java.lang.Exception
java.lang.RuntimeException
java.security.ProtectionDomain
java.security.AccessControlContext
java.lang.ClassNotFoundException
java.lang.NoClassDefFoundError
java.lang.ClassCastException
java.lang.ArrayStoreException
java.lang.VirtualMachineError
java.lang.OutOfMemoryError
java.lang.StackOverflowError
java.lang.IllegalMonitorStateException
java.lang.ref.Reference
java.lang.ref.SoftReference
java.lang.ref.WeakReference
java.lang.ref.FinalReference
java.lang.ref.PhantomReference
java.lang.ref.Finalizer
java.lang.Runnable
java.lang.Thread
java.lang.ThreadGroup
java.util.Properties
java.lang.reflect.AccessibleObject
java.lang.reflect.Member
java.lang.reflect.Field
java.lang.reflect.Method
java.lang.reflect.Constructor
java.lang.reflect.Type
sun.reflect.MagicAccessorImpl
sun.reflect.MethodAccessorImpl
sun.reflect.ConstructorAccessorImpl
sun.reflect.DelegatingClassLoader
sun.reflect.ConstantPool
sun.reflect.UnsafeStaticFieldAccessorImpl
java.util.Vector
java.lang.StringBuffer
java.lang.StackTraceElement
java.nio.Buffer
java.lang.Boolean
java.lang.Character
java.lang.Float
java.lang.Double
java.lang.Byte
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.NullPointerException
java.lang.ArithmeticException
java.lang.Compiler
# Root methods
java.lang.ClassLoader.getSystemClassLoader ()Ljava/lang/ClassLoader;
java.lang.System.initializeSystemClass ()V
sun.launcher.LauncherHelper.checkAndLoadMain (ZZLjava/lang/String;)Ljava/lang/Object;
# The tool doesn't automatically find superclasses and parse the method
# if overridden as it tries to reduce unnecessary classes being pulled in.
# The following forces the dependency to be included the result.
sun.net.www.protocol.file.Handler.<init> ()V
sun.net.www.protocol.jar.Handler.<init> ()V
sun.net.www.protocol.file.Handler.openConnection *
sun.net.www.protocol.jar.Handler.openConnection *
sun.misc.URLClassPath$JarLoader.<init> (Ljava/net/URL;Ljava/net/URLStreamHandler;Ljava/util/HashMap;)V
sun.misc.URLClassPath$FileLoader.<init> (Ljava/net/URL;)V
sun.misc.URLClassPath$FileLoader.getClassPath *
sun.misc.URLClassPath$FileLoader.getResource *
sun.misc.URLClassPath$JarLoader.getResource *
sun.misc.URLClassPath$JarLoader.getClassPath *
# permission collections
java.io.FilePermission.newPermissionCollection ()Ljava/security/PermissionCollection;
java.security.BasicPermission.newPermissionCollection ()Ljava/security/PermissionCollection;
# native
java.io.UnixFileSystem
java.io.UnixFileSystem.<init> ()V
java.io.UnixFileSystem.canonicalize *
java.io.Win32FileSystem
java.io.Win32FileSystem.<init> ()V
java.io.Win32FileSystem.canonicalize *
java.io.WinNTFileSystem
java.io.WinNTFileSystem.<init> ()V
java.io.WinNTFileSystem.canonicalize *
# missing
java.util.HashMap.<init> ()V
java.util.HashMap$EntrySet.iterator *
# Called from native GetStringPlatformChars (jni_util.c)
java.lang.String.getBytes *
# charset
sun.nio.cs.US_ASCII.newEncoder ()Ljava/nio/charset/CharsetEncoder;
sun.nio.cs.UTF_8.newEncoder ()Ljava/nio/charset/CharsetEncoder;
sun.nio.cs.UTF_8.newDecoder *
sun.nio.cs.UTF_16.newEncoder ()Ljava/nio/charset/CharsetEncoder;
sun.nio.cs.UTF_16.newDecoder *
sun.nio.cs.UTF_32.newEncoder ()Ljava/nio/charset/CharsetEncoder;
sun.nio.cs.UTF_32.newDecoder *
# hashcode
java.util.jar.Attributes$Name.hashCode *
# nio
sun.nio.ByteBuffered
sun.nio.ch.DirectBuffer
java.nio.DirectByteBuffer
java.nio.MappedByteBuffer
java.nio.DirectLongBufferU
# resource files
sun.launcher.resources.launcher
sun.misc.Launcher$AppClassLoader.getPermissions *
sun.misc.Launcher$AppClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class;
sun.misc.Launcher$AppClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class;
sun.misc.Launcher$ExtClassLoader.getPermissions *
sun.misc.Launcher$ExtClassLoader.loadClass (Ljava/lang/String;)Ljava/lang/Class;
sun.misc.Launcher$ExtClassLoader.findClass (Ljava/lang/String;)Ljava/lang/Class;
java.lang.ClassLoader.checkPackageAccess *
java.lang.ClassLoader.findClass *
java.lang.ClassLoader.defineClass *
java.net.URLClassLoader.getPermissions *
java.net.URLClassLoader.findClass *
java.net.URLClassLoader.defineClass *
java.security.SecureClassLoader.defineClass *
# need to parse superclasses <init>
java.security.SecureClassLoader.<init> ()V
exclude sun.security.provider.PolicyFile.<init>
exclude java.lang.ClassLoader.compareCerts
exclude java.security.cert.Certificate.equals
# unsigned jars - no verifier
exclude java.util.jar.JarFile.initializeVerifier
exclude java.util.jar.JarVerifier
exclude sun.security.util.SignatureFileVerifier.<init>
# what about other charset
exclude sun.misc.Service
exclude java.util.ServiceLoader
# exclude support for localized messages
exclude java.util.ResourceBundle.getBundle
exclude java.text.MessageFormat
exclude sun.util.logging.PlatformLogger$LoggerProxy.format *
# exclude nio and miscellaneous classes
exclude java.nio.channels.**
exclude sun.misc.FloatingDecimal
exclude sun.misc.FormattedFloatingDecimal
exclude sun.misc.FDBigInt

View File

@ -1,473 +0,0 @@
#
# Copyright (c) 2009, 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.
#
# 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.
#
# private java.lang.Object createInetSocketAddress(java.lang.String, int)
@ClassForName
com.sun.jndi.ldap.Connection -> java.net.InetSocketAddress
com.sun.jndi.ldap.Connection -> java.net.SocketAddress
# com.sun.jndi.ldap.VersionHelper
@ClassForName(optional)
com.sun.jndi.ldap.VersionHelper -> com.sun.jndi.ldap.VersionHelper*
# private static void initMethodHandles()
@ClassForName
com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.CORBA.Stub
com.sun.jndi.toolkit.corba.CorbaUtils -> javax.rmi.PortableRemoteObject
# com.sun.naming.internal.ResourceManager$AppletParameter
@ClassForName(optional)
com.sun.naming.internal.ResourceManager$AppletParameter -> java.applet.Applet
# private static boolean loadProviderAsService()
@Provider
com.sun.net.httpserver.spi.HttpServerProvider -> META-INF/services/com.sun.net.httpserver.spi.HttpServerProvider
# com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT
@ClassForName
com.sun.org.apache.xml.internal.security.transforms.implementations.TransformXSLT -> javax.xml.XMLConstants
# public static java.beans.PersistenceDelegate getPersistenceDelegate(java.lang.Class)
@ClassForName
java.beans.MetaData -> java.beans.*_PersistenceDelegate
# private static java.lang.reflect.Method getNanosMethod()
@ClassForName(optional)
java.beans.java_sql_Timestamp_PersistenceDelegate -> java.sql.Timestamp
# java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate
@ClassForName
java.beans.java_util_Collections$CheckedCollection_PersistenceDelegate -> java.util.Collections$CheckedCollection
# java.beans.java_util_Collections$CheckedMap_PersistenceDelegate
@ClassForName
java.beans.java_util_Collections$CheckedMap_PersistenceDelegate -> java.util.Collections$CheckedMap
# private static java.lang.Object getType(java.lang.Object)
@ClassForName
java.beans.java_util_EnumMap_PersistenceDelegate -> java.util.EnumMap
# private java.lang.Integer getAxis(java.lang.Object)
@ClassForName
java.beans.javax_swing_Box_PersistenceDelegate -> javax.swing.BoxLayout
# java.lang.Double
@Inline
java.lang.Double -> sun.misc.FloatConsts
java.lang.Double -> sun.misc.DoubleConsts
# java.lang.Float
@Inline
java.lang.Float -> sun.misc.FloatConsts
java.lang.Float -> sun.misc.DoubleConsts
# java.net.DefaultDatagramSocketImplFactory
@ClassForName(optional)
java.net.DefaultDatagramSocketImplFactory -> java.net.*DatagramSocketImpl
# private static sun.net.spi.nameservice.NameService createNSProvider(java.lang.String)
@Provider
java.net.InetAddress -> META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
# static java.net.InetAddressImpl create()
@ClassForName
java.net.InetAddressImplFactory -> java.net.*Inet[46]AddressImpl
# private static void init()
@NativeFindClass
java.net.PlainDatagramSocketImpl -> java.io.FileDescriptor
# java.net.ProxySelector
@ClassForName
java.net.ProxySelector -> sun.net.spi.DefaultProxySelector
# static java.net.URLStreamHandler getURLStreamHandler(java.lang.String)
@ClassForName(optional)
java.net.URL -> sun.net.www.protocol.*.Handler
# private java.net.ContentHandler lookupContentHandlerClassFor(java.lang.String)
@ClassForName
java.net.URLConnection -> sun.net.www.content.*
# private static java.nio.channels.spi.AsynchronousChannelProvider loadProviderAsService()
@Provider
java.nio.channels.spi.AsynchronousChannelProvider$ProviderHolder -> META-INF/services/java.nio.channels.spi.AsynchronousChannelProvider
# private static boolean loadProviderFromProperty()
@ClassForName
java.nio.channels.spi.SelectorProvider -> sun.nio.ch.DefaultSelectorProvider
# private static boolean loadProviderAsService()
@Provider
java.nio.channels.spi.SelectorProvider -> META-INF/services/java.nio.channels.spi.SelectorProvider
# private static java.util.Iterator providers()
@Provider
java.nio.charset.Charset -> META-INF/services/java.nio.charset.spi.CharsetProvider
# private static void probeExtendedProvider()
@ClassForName(optional)
java.nio.charset.Charset -> sun.nio.cs.ext.ExtendedCharsets
# public static java.nio.file.FileSystem newFileSystem(java.net.URI, java.util.Map<java.lang.String, ?>, java.lang.ClassLoader)
@Provider
java.nio.file.FileSystems -> META-INF/services/java.nio.file.FileSystemProvider
# private static java.util.List<java.nio.file.spi.FileTypeDetector> loadInstalledDetectors()
@Provider
java.nio.file.Files$DefaultFileTypeDetectorHolder -> META-INF/services/java.nio.file.spi.FileTypeDetector
# public static java.util.List<java.nio.file.spi.FileSystemProvider> installedProviders()
@Provider
java.nio.file.spi.FileSystemProvider -> META-INF/services/java.nio.file.FileSystemProvider
# private static java.rmi.server.RMIClassLoaderSpi initializeProvider()
@Provider
java.rmi.server.RMIClassLoader -> META-INF/services/java.rmi.server.RMIClassLoaderSpi
# private static void initializeSystemScope()
@ClassForName(optional)
java.security.IdentityScope -> sun.security.provider.IdentityDatabase
# static java.security.Policy getPolicyNoCheck()
@ClassForName
java.security.Policy -> sun.security.provider.PolicyFile
# private static java.lang.Class getSpiClass(java.lang.String)
@ClassForName
java.security.Security -> java.security.*Spi
# private static void invalidateSMCache(java.lang.String)
@ClassForName
java.security.Security -> java.lang.SecurityManager
# private static void loadInitialDrivers()
@Provider
java.sql.DriverManager -> META-INF/services/java.sql.Driver
# private static java.text.BreakIterator createBreakInstance(java.util.Locale, int, java.lang.String, java.lang.String)
@Provider
java.text.BreakIterator -> META-INF/services/java.util.spi.BreakIteratorProvider
# public static java.text.Collator getInstance(java.util.Locale)
@Provider
java.text.Collator -> META-INF/services/java.util.spi.CollatorProvider
# private static java.text.DateFormat get(int, int, int, java.util.Locale)
@Provider
java.text.DateFormat -> META-INF/services/java.util.spi.DateNameProvider
# public static java.util.Locale[] getAvailableLocales()
@Provider
java.text.DateFormatSymbols -> META-INF/services/java.util.spi.DateFormatSymbolsProvider
# public static java.util.Locale[] getAvailableLocales()
@Provider
java.text.DecimalFormatSymbols -> META-INF/services/java.util.spi.DecimalFormatSymbolsProvider
# public static java.util.Locale[] getAvailableLocales()
@Provider
java.text.NumberFormat -> META-INF/services/java.util.spi.NumberFormatProvider
# public java.lang.String getDisplayName(java.util.Locale)
@Provider
java.util.Currency -> META-INF/services/java.util.spi.CurrencyNameProvider
# java.util.Formatter
@Inline
java.util.Formatter -> sun.misc.DoubleConsts
# java.util.Locale
@Inline
java.util.Locale -> java.util.LocaleISOData
# private java.lang.String getDisplayString(java.lang.String, java.util.Locale, int)
@Provider
java.util.Locale -> META-INF/services/java.util.spi.LocaleNameProvider
# private static java.util.prefs.PreferencesFactory factory1()
@ClassForName
java.util.prefs.Preferences -> java.util.prefs.WindowsPreferencesFactory
java.util.prefs.Preferences -> java.util.prefs.FileSystemPreferencesFactory
# private static java.util.prefs.PreferencesFactory factory1()
@Provider
java.util.prefs.Preferences -> META-INF/services/java.util.prefs.PreferencesFactory
# public void registerApplicationClasspathSpis()
@Provider
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.IIOServiceProvider
# private void registerInstalledProviders()
@Provider
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderSpi
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageWriterSpi
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageReaderWriterSpi
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageTranscoderSpi
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageInputStreamSpi
javax.imageio.spi.IIORegistry -> META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
# public javax.naming.ldap.ExtendedResponse createExtendedResponse(java.lang.String, byte[], int, int)
@Provider
javax.naming.ldap.StartTlsRequest -> META-INF/services/javax.naming.ldap.StartTlsResponse
# private static java.util.ArrayList getAllLookupServices()
@Provider
javax.print.PrintServiceLookup -> META-INF/services/javax.print.PrintServiceLookup
# private static java.util.ArrayList getAllFactories()
@Provider
javax.print.StreamPrintServiceFactory -> META-INF/services/javax.print.StreamPrintServiceFactory
# private void initEngines(java.lang.ClassLoader)
@Provider
javax.script.ScriptEngineManager -> META-INF/services/javax.script.ScriptEngineFactory
# private void initializeInputMethodLocatorList()
@Provider
sun.awt.im.ExecutableInputMethodManager -> META-INF/services/java.awt.im.spi.InputMethodDescriptor
# private static java.lang.Class getConverterClass(int, java.lang.String)
@ClassForName(optional)
sun.io.Converters -> sun.io.*
# public static sun.java2d.cmm.PCMM getModule()
@Provider
sun.java2d.cmm.CMSManager -> META-INF/services/sun.java2d.cmm.PCMM
# public static sun.java2d.pipe.RenderingEngine getInstance()
@Provider
sun.java2d.pipe.RenderingEngine -> META-INF/services/sun.java2d.pipe.RenderingEngine
# public static sun.java2d.pipe.RenderingEngine getInstance()
@ClassForName(optional)
sun.java2d.pipe.RenderingEngine -> sun.dc.DuctusRenderingEngine
# sun.misc.FloatingDecimal
@Inline
sun.misc.FloatingDecimal -> sun.misc.FloatConsts
sun.misc.FloatingDecimal -> sun.misc.DoubleConsts
# sun.misc.FormattedFloatingDecimal
@Inline
sun.misc.FormattedFloatingDecimal -> sun.misc.FloatConsts
sun.misc.FormattedFloatingDecimal -> sun.misc.DoubleConsts
# sun.misc.FpUtils
@Inline
sun.misc.FpUtils -> sun.misc.FloatConsts
sun.misc.FpUtils -> sun.misc.DoubleConsts
# public java.net.URLStreamHandler createURLStreamHandler(java.lang.String)
@ClassForName(optional)
sun.misc.Launcher$Factory -> sun.net.www.protocol.*.Handler
# private static sun.net.NetHooks$Provider loadProvider(java.lang.String)
@ClassForName(optional)
sun.net.NetHooks -> sun.net.spi.SdpProvider
# sun.net.idn.StringPrep
@Inline
sun.net.idn.StringPrep -> sun.net.idn.UCharacterDirection
# private static boolean init()
@NativeFindClass
sun.net.spi.DefaultProxySelector -> java.net.Proxy
sun.net.spi.DefaultProxySelector -> java.net.Proxy$Type
sun.net.spi.DefaultProxySelector -> java.net.InetSocketAddress
# private static java.nio.channels.Channel createChannel()
@ClassForName
sun.nio.ch.InheritedChannel -> java.io.FileDescriptor
# private static void initDBBConstructor()
@ClassForName
sun.nio.ch.Util -> java.nio.DirectByteBuffer
# private static void initDBBRConstructor()
@ClassForName
sun.nio.ch.Util -> java.nio.DirectByteBufferR
# private java.nio.charset.Charset lookup(java.lang.String)
@ClassForName(optional)
sun.nio.cs.FastCharsetProvider -> sun.nio.cs.*
# sun.nio.cs.ext.ExtendedCharsets
@ClassForName(optional)
sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
# sun.nio.cs.ext.ExtendedCharsets
@ClassForName(optional)
sun.nio.cs.ext.ExtendedCharsets -> sun.nio.cs.ext.*
# public static java.nio.file.spi.FileSystemProvider create()
@ClassForName
sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.SolarisFileSystemProvider
sun.nio.fs.DefaultFileSystemProvider -> sun.nio.fs.LinuxFileSystemProvider
# sun.rmi.server.MarshalInputStream
@ClassForName
sun.rmi.server.MarshalInputStream -> sun.rmi.server.Activation$ActivationSystemImpl_Stub
sun.rmi.server.MarshalInputStream -> sun.rmi.registry.RegistryImpl_Stub
# private java.security.Provider doLoadProvider()
@ClassForName(optional)
sun.security.jca.ProviderConfig -> sun.security.pkcs11.SunPKCS11
sun.security.jca.ProviderConfig -> sun.security.provider.Sun
sun.security.jca.ProviderConfig -> sun.security.rsa.SunRsaSign
sun.security.jca.ProviderConfig -> sun.security.ec.SunEC
sun.security.jca.ProviderConfig -> com.sun.net.ssl.internal.ssl.Provider
sun.security.jca.ProviderConfig -> com.sun.crypto.provider.SunJCE
sun.security.jca.ProviderConfig -> sun.security.jgss.SunProvider
sun.security.jca.ProviderConfig -> com.sun.security.sasl.Provider
sun.security.jca.ProviderConfig -> org.jcp.xml.dsig.internal.dom.XMLDSigRI
sun.security.jca.ProviderConfig -> sun.security.smartcardio.SunPCSC
sun.security.jca.ProviderConfig -> sun.security.mscapi.SunMSCAPI
# public static java.security.Provider getSunProvider()
@ClassForName
sun.security.jca.Providers -> sun.security.provider.Sun
sun.security.jca.Providers -> sun.security.provider.VerificationProvider
# private static sun.security.jgss.spi.MechanismFactory getMechFactoryImpl(java.security.Provider, java.lang.String, org.ietf.jgss.Oid, sun.security.jgss.GSSCaller)
@ClassForName
sun.security.jgss.ProviderList -> sun.security.jgss.spi.MechanismFactory
# sun.security.jgss.wrapper.SunNativeProvider
@NativeFindClass
sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.Oid
sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.GSSException
sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSNameElement
sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSCredElement
sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.NativeGSSContext
sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.SunNativeProvider
sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.MessageProp
sun.security.jgss.wrapper.SunNativeProvider -> org.ietf.jgss.ChannelBinding
sun.security.jgss.wrapper.SunNativeProvider -> java.net.InetAddress
sun.security.jgss.wrapper.SunNativeProvider -> sun.security.jgss.wrapper.GSSLibStub
# static void ensureLoaded()
@NativeFindClass
sun.security.krb5.Credentials -> sun.security.krb5.internal.Krb5
sun.security.krb5.Credentials -> sun.security.krb5.internal.Ticket
sun.security.krb5.Credentials -> sun.security.krb5.PrincipalName
sun.security.krb5.Credentials -> sun.security.util.DerValue
sun.security.krb5.Credentials -> sun.security.krb5.EncryptionKey
sun.security.krb5.Credentials -> sun.security.krb5.internal.TicketFlags
sun.security.krb5.Credentials -> sun.security.krb5.internal.KerberosTime
# public static java.lang.String getDefaultCacheName()
@ClassForName(optional)
sun.security.krb5.internal.ccache.FileCredentialsCache -> com.sun.security.auth.module.UnixSystem
# sun.security.pkcs.PKCS9Attribute
@ClassForName
sun.security.pkcs.PKCS9Attribute -> sun.security.util.ObjectIdentifier
sun.security.pkcs.PKCS9Attribute -> java.util.Date
sun.security.pkcs.PKCS9Attribute -> sun.security.pkcs.SignerInfo
sun.security.pkcs.PKCS9Attribute -> sun.security.x509.CertificateExtensions
# protected T engineGetKeySpec(java.security.Key, java.lang.Class<T>)
@ClassForName
sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPublicKeySpec
sun.security.provider.DSAKeyFactory -> java.security.spec.X509EncodedKeySpec
sun.security.provider.DSAKeyFactory -> java.security.spec.DSAPrivateKeySpec
sun.security.provider.DSAKeyFactory -> java.security.spec.PKCS8EncodedKeySpec
# protected T engineGetParameterSpec(java.lang.Class<T>)
@ClassForName
sun.security.provider.DSAParameters -> java.security.spec.DSAParameterSpec
# sun.security.provider.VerificationProvider
@ClassForName(optional)
sun.security.provider.VerificationProvider -> sun.security.provider.Sun
sun.security.provider.VerificationProvider -> sun.security.rsa.SunRsaSign
# sun.security.provider.certpath.URICertStore$LDAP
@ClassForName(optional)
sun.security.provider.certpath.URICertStore$LDAP -> sun.security.provider.certpath.ldap.LDAPCertStoreHelper
# sun.security.smartcardio.PCSC
@NativeFindClass
sun.security.smartcardio.PCSC -> sun.security.smartcardio.PCSCException
# sun.security.ssl.HandshakeMessage
@ClassForName
sun.security.ssl.HandshakeMessage -> java.security.MessageDigest$Delegate
# sun.security.ssl.JsseJce
@ClassForName(optional)
sun.security.ssl.JsseJce -> sun.security.krb5.PrincipalName
# sun.security.x509.OIDMap$OIDInfo
@ClassForName
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectKeyIdentifierExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.KeyUsageExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PrivateKeyUsageExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectAlternativeNameExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuerAlternativeNameExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.BasicConstraintsExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLNumberExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLReasonCodeExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NameConstraintsExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyMappingsExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityKeyIdentifierExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.PolicyConstraintsExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.NetscapeCertTypeExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificatePoliciesExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.ExtendedKeyUsageExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.InhibitAnyPolicyExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CRLDistributionPointsExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.CertificateIssuerExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.SubjectInfoAccessExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.AuthorityInfoAccessExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.IssuingDistributionPointExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.DeltaCRLIndicatorExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.FreshestCRLExtension
sun.security.x509.OIDMap$OIDInfo -> sun.security.x509.OCSPNoCheckExtension
# sun.util.LocaleServiceProviderPool$AllAvailableLocales
@Provider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.BreakIteratorProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.CollatorProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DateFormatSymbolsProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.DecimalFormatSymbolsProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.text.spi.NumberFormatProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.CurrencyNameProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.LocaleNameProvider
sun.util.LocaleServiceProviderPool$AllAvailableLocales -> META-INF/services/java.util.spi.TimeZoneNameProvider
# private static final java.lang.String[] retrieveDisplayNames(sun.util.resources.OpenListResourceBundle, java.lang.String, java.util.Locale)
@Provider
sun.util.TimeZoneNameUtility -> META-INF/services/java.util.spi.TimeZoneNamePProvider
# public static sun.util.calendar.CalendarSystem forName(java.lang.String)
@ClassForName
sun.util.calendar.CalendarSystem -> sun.util.calendar.Gregorian
sun.util.calendar.CalendarSystem -> sun.util.calendar.LocalGregorianCalendar
sun.util.calendar.CalendarSystem -> sun.util.calendar.JulianCalendar
# sun.util.logging.LoggingSupport
@ClassForName(optional)
sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl

View File

@ -1,928 +0,0 @@
/*
* Copyright (c) 2009, 2010, 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.
*
* 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.
*/
// These classes are not referenced in the JDK but we can't
// remove them for compatibility reason. Define this module
// first so that other modules don't need to exclude these clases
module private-legacy {
include sun.misc.Cache*,
sun.misc.ClassLoaderUtil,
sun.misc.Compare,
sun.misc.ConditionLock,
sun.misc.CRC16,
sun.misc.Lock,
sun.misc.Regexp,
sun.misc.RequestProcessor,
sun.misc.Sort,
sun.misc.Request,
sun.misc.Timeable,
sun.misc.Timer,
sun.misc.TimerThread,
sun.misc.TimerTickThread,
sun.misc.UCDecoder,
sun.misc.UCEncoder,
sun.misc.UUDecoder,
sun.misc.UUEncoder,
com.sun.net.ssl.SSLContext,
sun.net.NetworkServer,
sun.net.URLCanonicalizer,
sun.reflect.misc.ConstructorUtil,
sun.reflect.FieldInfo,
sun.reflect.SignatureIterator,
sun.reflect.generics.reflectiveObjects.NotImplementedException,
sunw.io.Serializable,
sunw.util.EventListener,
sunw.util.EventObject;
}
// Deprecated classes that aren't referenced/used go here.
module deprecated {
// add deprecated security classes once b78 is promoted
}
/**************************************************************************/
module base {
// core classes
include java.lang.*,
java.lang.annotation.*,
java.lang.ref.*,
java.lang.reflect.*,
java.math.*,
java.net.*,
java.util.*,
java.util.concurrent.**,
java.util.jar.*,
java.util.regex.*,
java.util.spi.*,
java.util.zip.*,
java.text.**;
exclude java.util.jar.Pack200*,
java.util.XMLUtils,
java.text.Bidi;
include java.io.*, java.nio.*, java.nio.charset.**;
exclude java.io.TempFileHelper, java.nio.BufferPoolMXBean;
// security APIs
// javax.crypto and javax.security.auth are included to avoid inconsistent
// spliting of JCA and JAAS. This adds about 85k. Also note that some deprecated
// classes must be included for now (see 6876158, 6876170)
include java.security.*,
java.security.cert.*,
java.security.interfaces.*,
java.security.spec.*,
javax.security.auth.**,
javax.crypto.**;
// Sun and RSA security providers (except LDAP CertStore)
// roots sun.security.provider.* sun.security.provider.certpath.* sun.security.rsa.*
include com.sun.security.auth.PrincipalComparator,
com.sun.security.auth.SubjectCodeSource,
com.sun.security.auth.login.**,
com.sun.security.auth.Policy*,
sun.security.action.*,
sun.security.ec.*,
sun.security.jca.*,
sun.security.pkcs.*,
sun.security.provider.*,
sun.security.provider.certpath.*,
sun.security.rsa.*,
sun.security.util.*,
sun.security.validator.*,
sun.security.x509.*,
sun.security.timestamp.*;
// this list is based on the classlist generated from the rootset
// need investigation
exclude sun.security.ec.ECD*,
sun.security.ec.ECKeyPairGenerator,
sun.security.ec.SunEC*,
sun.security.pkcs.PKCS10*,
sun.security.pkcs.EncodingException,
sun.security.util.AuthResources_*,
sun.security.util.Resources_*,
sun.security.util.BigInt,
sun.security.util.HostnameChecker,
sun.security.x509.CertAndKeyGen,
sun.security.util.PathList;
// Kerberos not needed
exclude javax.security.auth.kerberos.**,
sun.security.jgss.**,
sun.security.krb5.**,
sun.security.ssl.Kerberos*,
org.ietf.jgss.**;
// property events and annotations
include java.beans.ChangeListenerMap,
java.beans.IndexedPropertyChangeEvent,
java.beans.PropertyChange*,
java.beans.PropertyVetoException,
java.beans.VetoableChange*,
java.beans.ConstructorProperties;
// mandatory charsets
include sun.nio.cs.*;
exclude sun.nio.cs.AbstractCharsetProvider,
sun.nio.cs.CharsetMapping,
sun.nio.cs.IBM*,
sun.nio.cs.ISO*,
sun.nio.cs.KOI8_*,
sun.nio.cs.MS125*,
sun.nio.cs.UTF_32*,
sun.nio.cs.SingleByteDecoder,
sun.nio.cs.SingleByteEncoder;
allow sun.nio.cs.ISO_8859_1,
sun.nio.cs.ISO_8859_15,
sun.nio.cs.MS1252;
include sun.text.*,
sun.text.normalizer.*;
// resource files
include sun/text/resources/*.icu;
exclude sun.text.bidi.*,
sun.text.CharArrayCodePointIterator,
sun.text.CharSequenceCodePointIterator,
sun.text.CharacterIteratorCodePointIterator,
sun.text.CodePointIterator;
include sun.util.*,
sun.util.calendar.*,
sun.util.logging.*,
sun.util.resources.LocaleData,
sun.util.resources.LocaleNamesBundle,
sun.util.resources.OpenListResourceBundle;
// US_en locale
include sun.text.resources.BreakIteratorInfo,
sun.text.resources.FormatData,
sun.text.resources.FormatData_en_US,
sun.util.resources.CalendarData,
sun.util.resources.CalendarData_en,
sun.util.resources.TimeZoneNames,
sun.util.resources.TimeZoneNames_en,
sun.util.resources.TimeZoneNamesBundle,
sun.util.resources.LocaleNames,
sun.util.resources.LocaleNames_en,
sun.util.resources.LocalenamesBundles,
sun.util.resources.CurrencyNames,
sun.util.resources.CurrencyNames_en_US,
sun.util.EmptyListResourceBundle;
// resources file needed by
// - sun.misc.ExtensionInfo
// - sun.security.provider.PolicyFile
// - com.sun.security.auth.PolicyFile
include sun.misc.resources.Messages,
sun.security.util.Resources,
sun.security.util.AuthResources;
// java.nio.channels and java.nio.file not in base
include sun.nio.ch.Interruptible,
sun.nio.ch.DirectBuffer,
sun.nio.ByteBuffered;
include sun.reflect.**;
// protocol handlers
include sun.net.www.protocol.file.*,
sun.net.www.protocol.jar.*,
sun.net.www.protocol.http.*;
include sun.net.*,
sun.net.spi.*,
sun.net.idn.*,
sun.net.util.*,
sun.net.www.*,
sun.net.www.http.*,
sun.net.spi.nameservice.*;
// resource file for sun.net.idn
include sun/net/idn/*;
// classes in net-compat
exclude sun.net.Telnet*, sun.net.TransferProtocolClient;
// classes in deploy
exclude sun.net.www.protocol.http.AuthCacheBridge;
// classes in security-jsse
exclude java.net.SecureCacheResponse;
// launcher
include sun.launcher.LauncherHelper, sun.launcher.resources.launcher;
include sun.misc.*;
exclude sun.misc.FIFOQueueEnumerator,
sun.misc.LIFOQueueEnumerator,
sun.misc.GC,
sun.misc.PerformanceLogger,
sun.misc.Queue,
sun.misc.QueueElement,
sun.misc.Ref,
sun.misc.VMSupport;
// On Windows, OSEnvironment dependency
include sun.io.Win32ErrorMode;
}
/**************************************************************************/
module charsets {
include sun.nio.cs.ext.**;
include sun.nio.cs.AbstractCharsetProvider,
sun.nio.cs.CharsetMapping,
sun.nio.cs.IBM*,
sun.nio.cs.ISO*,
sun.nio.cs.KOI8_*,
sun.nio.cs.MS125*,
sun.nio.cs.SingleByte*,
sun.nio.cs.UTF_32*;
exclude sun.nio.cs.ISO_8859_1,
sun.nio.cs.MS1252;
// legacy sun.io converters
include sun.io.*;
}
/**************************************************************************/
// For now, retains the current JRE extensions where localedata.jar in jre/lib/ext
module localedata {
include sun.util.resources.*_ar,
sun.util.resources.*_ar_*,
sun.util.resources.*_hi,
sun.util.resources.*_hi_*,
sun.util.resources.*_iw,
sun.util.resources.*_iw_*,
sun.util.resources.*_ja,
sun.util.resources.*_ja_*,
sun.util.resources.*_ko,
sun.util.resources.*_ko_*,
sun.util.resources.*_th,
sun.util.resources.*_th_*,
sun.util.resources.*_vi,
sun.util.resources.*_vi_*,
sun.util.resources.*_zh,
sun.util.resources.*_zh_*;
include sun.text.resources.*_ar,
sun.text.resources.*_ar_*,
sun.text.resources.*_hi,
sun.text.resources.*_hi_*,
sun.text.resources.*_iw,
sun.text.resources.*_iw_*,
sun.text.resources.*_ja,
sun.text.resources.*_ja_*,
sun.text.resources.*_ko,
sun.text.resources.*_ko_*,
sun.text.resources.*_th,
sun.text.resources.*_th_*,
sun.text.resources.*_vi,
sun.text.resources.*_vi_*,
sun.text.resources.*_zh,
sun.text.resources.*_zh_*;
}
module resources {
include sun.text.resources.*, sun.util.resources.*, sun.misc.resources.*;
}
/**************************************************************************/
module nio {
include java.nio.channels.**, java.nio.file.**, com.sun.nio.file.**;
// this is excluded from base
include java.io.TempFileHelper;
// provider implementations and their dependencies
include sun.nio.ch.*, sun.nio.fs.**;
exclude sun.nio.ch.Sctp*;
}
/**************************************************************************/
module pack200 {
include java.util.jar.Pack200*, com.sun.java.util.jar.pack.**;
}
/**************************************************************************/
module logging {
include java.util.logging.*, sun.util.logging.**;
exclude java.util.logging.PlatformLoggingMXBean;
// Formatter for HTTP messages
include sun.net.www.protocol.http.logging.*;
}
/**************************************************************************/
module management-snmp {
include com.sun.jmx.snmp.**, sun.management.snmp.**;
}
module management-iiop {
include com.sun.jmx.remote.protocol.iiop.*;
// stubs and ties
include javax.management.remote.rmi._*,
org.omg.stub.javax.management.remote.rmi.**;
}
module management {
include java.lang.management.*, com.sun.management.**, sun.management.**;
include javax.management.**, com.sun.jmx.**;
// other management interfaces
include java.nio.BufferPoolMXBean;
include java.util.logging.PlatformLoggingMXBean;
// supporting classes in sun.misc
include sun.misc.VMSupport;
}
/**************************************************************************/
module tracing {
// tracing
include com.sun.tracing.**, sun.tracing.**;
}
module instrument {
// java.lang.instrument
include java.lang.instrument.*, sun.instrument.*;
// HPROF support
include com.sun.demo.jvmti.hprof.*;
include tracing;
}
/**************************************************************************/
module rmi-activation {
include java.rmi.activation.**,
sun.rmi.server.Act*,
sun.rmi.server.InactiveGroupException;
}
module rmic {
// rmic is included in tools
include sun.rmi.rmic.**;
}
module rmi {
include java.rmi.**, sun.rmi.**, com.sun.rmi.**;
// SSL factories are in rmi
include javax.rmi.ssl.**;
// supporting classes in sun.misc and dependencies
include sun.misc.GC;
}
/**************************************************************************/
module prefs {
include java.util.prefs.*;
}
/**************************************************************************/
module security-jsse {
include javax.net.**,
javax.security.cert.*,
java.net.SecureCacheResponse,
com.sun.net.ssl.**,
com.sun.security.cert.internal.x509.*,
sun.security.ssl.*,
sun.net.www.protocol.https.**,
sun.security.internal.interfaces.Tls*,
sun.security.internal.spec.Tls*,
sun.security.util.HostnameChecker;
}
module security-sunpkcs11 {
include sun.security.pkcs11.**;
}
module security-sunjce {
include com.sun.crypto.provider.*;
}
module security-sunec {
include sun.security.ec.*;
}
module security-sunmscapi {
include sun.security.mscapi.*;
}
module security-kerberos {
include javax.security.auth.kerberos.*,
com.sun.security.jgss.**,
com.sun.security.auth.module.Krb5LoginModule,
com.sun.security.sasl.gsskerb.**, // GSSAPI SASL mechanism
sun.security.jgss.**,
sun.security.ssl.krb5.**,
sun.security.krb5.**,
org.ietf.jgss.**,
sun.net.www.protocol.http.spnego.*;
}
module security-sasl {
include javax.security.sasl.**,
com.sun.security.sasl.**;
}
module security-xmldsig {
include javax.xml.crypto.**,
org.jcp.xml.dsig.**,
com.sun.org.apache.xml.internal.security.**;
}
module security-smartcardio {
include javax.smartcardio.**, sun.security.smartcardio.**;
}
module security-auth {
include com.sun.security.auth.**, sun.security.util.AuthResources_*;
}
module security-misc {
include security-auth;
include sun.security.pkcs.*,
sun.security.pkcs12.*;
// this class is a candidate to be removed.
include sun.security.util.BigInt;
}
module security-resources {
include sun.security.util.Resources_*;
}
module security-compat {
include java.security.acl.*, sun.security.acl.*;
}
/**************************************************************************/
module jndi-ldap {
include javax.naming.ldap.**,
com.sun.jndi.ldap.**,
com.sun.jndi.url.ldap.*,
com.sun.jndi.url.ldaps.*,
sun.security.provider.certpath.ldap.**;
}
module jndi-rmiregistry {
include com.sun.jndi.rmi.**, com.sun.jndi.url.rmi.**;
}
module jndi-dns {
include net-dns;
include com.sun.jndi.dns.**, com.sun.jndi.url.dns.**;
}
module jndi-cosnaming {
include com.sun.jndi.cosnaming.**,
com.sun.jndi.toolkit.corba.**,
com.sun.jndi.url.corbaname.**,
com.sun.jndi.url.iiop.**,
com.sun.jndi.url.iiopname.**;
}
// framework/API and classes used by providers
module jndi {
include javax.naming.**,
com.sun.naming.**,
com.sun.jndi.toolkit.ctx.**,
com.sun.jndi.toolkit.dir.**,
com.sun.jndi.toolkit.url.**;
}
/**************************************************************************/
module jdbc-base {
include java.sql.**, javax.sql.*;
exclude javax.sql.XA*;
}
module jdbc-enterprise {
include javax.sql.**, com.sun.rowset.**;
}
module jdbc-odbc {
include sun.jdbc.odbc.**;
}
/**************************************************************************/
module scripting {
include javax.script.**;
// supporting classes for scripting engines
include com.sun.script.util.**;
}
module scripting-rhino {
include com.sun.script.javascript.**, sun.org.mozilla.javascript.**;
}
/**************************************************************************/
module httpserver {
include com.sun.net.httpserver.**, sun.net.httpserver.**;
}
/**************************************************************************/
module sctp {
// API and dependencies
include com.sun.nio.sctp.**, sun.nio.ch.Sctp*;
}
/**************************************************************************/
module langtools {
include javax.tools.**, javax.lang.model.**, javax.annotation.processing.**;
// include mirror API for now
include com.sun.mirror.**;
// include the JSR292 APIs for now
include java.dyn.**, sun.dyn.**;
}
/**************************************************************************/
module beans {
include java.beans.**, com.sun.beans.**, sun.beans.**;
}
/**************************************************************************/
module jaxp-parsers-api {
include javax.xml.*, javax.xml.parsers.**,
org.w3c.dom.**, org.w3c.sax.**, org.xml.sax.**;
}
module jaxp-api {
include javax.xml.**;
exclude javax.xml.crypto.**, // XML-DSIG
javax.xml.bind.**, // JAX-WS
javax.xml.soap.**,
javax.xml.ws.**;
}
module jaxp-xerces-impl {
include com.sun.org.apache.xerces.internal.**;
// include in xerces-impl due to circular dependencies
include com.sun.org.apache.xml.internal.serialize.**,
com.sun.xml.internal.stream.**;
exclude com.sun.xml.internal.stream.buffer.**; // JAX-WS
}
// required by Xerces and JAX-WS
module jaxp-xerces-resolver {
include com.sun.org.apache.xml.internal.resolver.**;
}
module jaxp-xalan {
include com.sun.org.apache.xalan.internal.**,
com.sun.org.apache.xpath.internal.**,
com.sun.org.apache.xml.internal.dtm.**,
com.sun.org.apache.xml.internal.res.**,
com.sun.org.apache.xml.internal.serializer.**,
com.sun.org.apache.xml.internal.utils.**,
com.sun.org.apache.bcel.internal.**,
com.sun.org.apache.regexp.internal.**,
com.sun.java_cup.internal.**;
}
/**************************************************************************/
module jaxws-tools {
include com.sun.codemodel.**,
com.sun.xml.internal.dtdparser.**,
com.sun.xml.internal.rngom.**,
com.sun.xml.internal.xsom.**,
com.sun.istack.internal.tools.**,
com.sun.istack.internal.ws.**,
com.sun.tools.internal.xjc.**,
com.sun.tools.internal.ws.**,
com.sun.tools.internal.jxc.**,
org.relaxng.datatype.**;
}
module jaxws {
include javax.jws.**,
javax.xml.bind.**,
javax.xml.soap.**,
javax.xml.ws.**,
org.relaxng.**,
com.sun.istack.internal.*,
com.sun.istack.internal.localization.*,
com.sun.xml.internal.**;
// include JAF in this module
include javax.activation.**, com.sun.activation.**;
include META-INF/mailcap.default,
META-INF/mimetypes.default;
}
/**************************************************************************/
module enterprise-base {
include javax.transaction.**, // JTA
javax.annotation.*; // Common annotations (JSR-250)
}
/**************************************************************************/
module corba {
include javax.activity.**,
javax.rmi.*,
javax.rmi.CORBA.*,
javax.transaction.**,
com.sun.corba.**,
com.sun.org.omg.**,
org.omg.**,
sun.corba.**;
// JMX remote API
exclude org.omg.stub.javax.management.**;
}
/**************************************************************************/
module applet {
include java.applet.**,
sun.applet.**;
}
module awt {
include java.awt.**,
sun.awt.**,
com.sun.awt.**;
}
module font {
include sun.font.**;
}
module imageio {
include javax.imageio.**,
com.sun.imageio.**;
}
module java2d {
include sun.dc.**,
sun.java2d.**,
com.sun.image.**;
}
module media {
include com.sun.media.**;
}
module print {
include javax.print.**,
sun.print.**;
}
module sound {
include javax.sound.**;
}
module swing {
include javax.swing.**,
sun.swing.**,
// sajdi also contains classes in subpackages of com.sun.java.swing;
// so use '*' instead of '**'
com.sun.java.swing.*,
com.sun.java.swing.plaf.**,
com.sun.swing.**;
}
module client {
include applet,
awt,
font,
imageio,
java2d,
media,
print,
sound,
swing;
include javax.accessibility.*,
sun.audio.**,
com.sun.accessibility.**;
// Bidi class in client module for now
include java.text.Bidi, sun.text.bidi.*;
// PerformanceLogger and dependencies
include sun.misc.Ref, sun.misc.PerformanceLogger;
// misc. dependencies that we need to examine
include sun.text.CodePointIterator,
sun.text.Char*,
sun.misc.Queue*,
sun.misc.FIFOQueueEnumerator,
sun.misc.LIFOQueueEnumerator;
// content handlers
include sun.net.www.content.audio.**,
sun.net.www.content.image.**;
}
/**************************************************************************/
module deploy {
// For now, all plugin and JNLP
include com.sun.java.browser.**,
netscape.**,
sun.plugin.**,
sun.plugin2.**,,
com.sun.deploy.**,
com.sun.javaws.**,
javax.jnlp.*,
com.sun.jnlp.*;
// Hook for http authentication
include sun.net.www.protocol.http.AuthCacheBridge;
}
/**************************************************************************/
module net-dns {
include sun.net.dns.**; // to access DNS config.
include sun.net.spi.nameservice.dns.**; // for DNS-only name service.
}
module net-compat {
// NTLM authentication support
include sun.net.www.protocol.http.ntlm.*;
// ftp and mail clients
include sun.net.ftp.**, sun.net.smtp.**;
// Legacy protocol handlers
include sun.net.www.protocol.**;
// Legacy content handlers
include sun.net.www.content.**;
include sun.net.Telnet*,
sun.net.TransferProtocolClient;
}
/**************************************************************************/
// jar-tool and security-tools are JRE tools
module jar-tool {
include sun.tools.jar.**;
}
module policytool {
include sun.security.tools.policytool.*;
}
module security-tools {
include sun.security.tools.**;
// Used by security tools
include sun.security.util.PathList, sun.security.x509.CertAndKeyGen;
exclude sun.security.tools.JarBASE64Encoder,
sun.security.tools.JarSigner,
sun.security.tools.JarSignerParameters,
sun.security.tools.JarSignerResources*,
sun.security.tools.SignatureFile,
sun.security.tools.TimestampedSigner;
}
module jconsole {
include sun.tools.jconsole.**,
com.sun.tools.jconsole.*;
}
module serialver {
include sun.tools.serialver.**;
}
module gui-tools {
include jconsole,
serialver;
include com.sun.tools.example.debug.bdi.**,
com.sun.tools.example.debug.gui.**,
com.sun.tools.internal.xjc.**;
}
module attach {
include com.sun.tools.attach.**,
sun.tools.attach.**;
}
module debugging {
include com.sun.jdi.**, com.sun.tools.jdi.**;
}
module jdb {
include com.sun.tools.example.debug.**;
}
module sajdi {
include sun.jvm.hotspot.**,
com.sun.java.swing.ui.**,
com.sun.java.swing.action.**;
include toolbarButtonGraphics/**;
include sa.properties;
}
module tools {
include attach,
debugging,
jaxws-tools,
jdb,
rmic,
sajdi;
// include gui-tools in tools module unless the tool binaries
// are modified to load the new gui-tools.jar
include gui-tools;
include com.sun.tools.**, sun.tools.**, sun.security.tools.**,
com.sun.jarsigner.**,
com.sun.javac.**,
com.sun.javadoc.**, com.sun.source.**,
sun.jvmstat.**;
}
/**************************************************************************/
module servicetag {
include com.sun.servicetag.**;
}
/**************************************************************************/
// these classes will be removed from JRE - see 6909002
module inputmethods-ext {
include com.sun.inputmethods.internal.**;
}
/**************************************************************************/
// Workaround for US export and local policy files
// They are currently in signed jars under the jre/lib/security directory
module US_export_policy {
include default_US_export.policy;
}
module local_policy {
include default_local.policy,
exempt_local.policy;
}
/**************************************************************************/
module other {
include **;
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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.
*/
/*
* Example:
* module jdbc {
* include jdbc-base, jdbc-enterprise, jdbc-odbc;
* }
*/

View File

@ -1,149 +0,0 @@
#
# Copyright (c) 2009, 2010, 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.
#
# public final java.nio.channels.SocketChannel getChannel()
@Optional
sun.security.ssl.BaseSSLSocketImpl -> java.nio.channels.SocketChannel
# public XMLDecoder(java.io.InputStream)
# public XMLDecoder(java.io.InputStream, java.lang.Object)
# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener)
# public XMLDecoder(java.io.InputStream, java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader)
# public XMLDecoder(org.xml.sax.InputSource)
@Optional
java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler
java.beans.XMLDecoder -> org.xml.sax.InputSource
# public static org.xml.sax.helpers.DefaultHandler createHandler(java.lang.Object, java.beans.ExceptionListener, java.lang.ClassLoader)
@Optional
java.beans.XMLDecoder -> com.sun.beans.decoder.DocumentHandler
java.beans.XMLDecoder -> org.xml.sax.helpers.DefaultHandler
# public final java.nio.channels.FileChannel getChannel()
@Optional
java.net.SocketInputStream -> java.nio.channels.FileChannel
# public final java.nio.channels.FileChannel getChannel()
@Optional
java.net.SocketOutputStream -> java.nio.channels.FileChannel
# public Scanner(java.io.File)
# public Scanner(java.io.File, java.lang.String)
@Optional
java.util.Scanner -> java.nio.channels.ReadableByteChannel
java.util.Scanner -> java.nio.channels.Channels
# public Scanner(java.nio.file.FileRef)
# public Scanner(java.nio.file.FileRef, java.lang.String)
@Optional
java.util.Scanner -> java.nio.file.FileRef
java.util.Scanner -> java.nio.file.OpenOption
# public Scanner(java.nio.channels.ReadableByteChannel)
# public Scanner(java.nio.channels.ReadableByteChannel, java.lang.String)
@Optional
java.util.Scanner -> java.nio.channels.ReadableByteChannel
java.util.Scanner -> java.nio.channels.Channels
# private static void loadSnmpAgent(java.lang.String, java.util.Properties)
@Optional
sun.management.Agent -> sun.management.snmp.AdaptorBootstrap
# public void connect()
@Optional
sun.net.www.protocol.http.HttpURLConnection -> java.net.SecureCacheResponse
# private static sun.security.util.PermissionFactory<?> permissionFactory()
@Optional
sun.security.util.SecurityConstants$AWT -> sun.awt.AWTPermissionFactory
# sun.util.logging.LoggingSupport
@Optional
sun.util.logging.LoggingSupport -> java.util.logging.LoggingProxyImpl
# public java.nio.channels.DatagramChannel getChannel()
@Optional
java.net.DatagramSocket -> java.nio.channels.DatagramChannel
# public java.nio.channels.SocketChannel getChannel()
@Optional
java.net.Socket -> java.nio.channels.SocketChannel
# public java.nio.channels.ServerSocketChannel getChannel()
@Optional
java.net.ServerSocket -> java.nio.channels.ServerSocketChannel
# public final java.nio.channels.FileChannel getChannel()
@Optional
java.io.RandomAccessFile -> java.nio.channels.FileChannel
java.io.RandomAccessFile -> sun.nio.ch.FileChannelImpl
# public static sun.nio.cs.StreamDecoder forDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int)
@Optional
sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel
# private static java.nio.channels.FileChannel getChannel(java.io.FileInputStream)
# StreamDecoder(java.io.InputStream, java.lang.Object, java.nio.charset.CharsetDecoder)
@Optional
sun.nio.cs.StreamDecoder -> java.nio.channels.FileChannel
# StreamDecoder(java.nio.channels.ReadableByteChannel, java.nio.charset.CharsetDecoder, int)
@Optional
sun.nio.cs.StreamDecoder -> java.nio.channels.ReadableByteChannel
# public static java.io.File createTemporaryFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute<?>[])
@Optional
java.io.File -> java.io.TempFileHelper
java.io.File -> java.nio.file.attribute.FileAttribute
# public java.nio.file.Path toPath()
@Optional
java.io.File -> java.nio.file.Paths
java.io.File -> java.nio.file.Path
# public static sun.nio.cs.StreamEncoder forEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int)
# private StreamEncoder(java.nio.channels.WritableByteChannel, java.nio.charset.CharsetEncoder, int)
@Optional
sun.nio.cs.StreamEncoder -> java.nio.channels.WritableByteChannel
# public java.nio.channels.FileChannel getChannel()
@Optional
java.io.FileOutputStream -> java.nio.channels.FileChannel
java.io.FileOutputStream -> sun.nio.ch.FileChannelImpl
# public java.nio.channels.FileChannel getChannel()
@Optional
java.io.FileInputStream -> java.nio.channels.FileChannel
java.io.FileInputStream -> sun.nio.ch.FileChannelImpl
# public void loadFromXML(java.io.InputStream)
# public void storeToXML(java.io.OutputStream, java.lang.String, java.lang.String)
@Optional
java.util.Properties -> java.util.XMLUtils
# public static java.nio.channels.Channel inheritedChannel()
@Optional
java.lang.System -> java.nio.channels.Channel
java.lang.System -> java.nio.channels.spi.SelectorProvider

View File

@ -1,154 +0,0 @@
#
# Copyright (c) 2009, 2010, 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.
#
#
# Makefile for building the classanalyzer tool
#
BUILDDIR = ../..
include $(BUILDDIR)/common/Defs.gmk
PKGDIR = com/sun/classanalyzer
BUILDTOOL_SOURCE_ROOT = src
BUILDTOOL_MAIN = $(PKGDIR)/ClassAnalyzer.java
BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%))
BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN)
BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/classanalyzer_manifest.mf
FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \
&& $(FIND) $(PKGDIR) -type f -print)
FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class)
CLASSANALYZER_JAR_FILE = $(BUILDTOOLJARDIR)/classanalyzer.jar
#
# ClassAnalyzer depends on the com.sun.tools.classfile API.
# The tool is compiled with the latest version of the classfile
# library in the langtools repo to make sure that synchronized
# change is made if the classfile API is changed.
#
# If langtools repo exists, build its own copy of the
# classfile library and use it for compile time and runtime.
# If not exist (the top level repo is not a forest), use
# the built jdk tools that imports tools.jar from the latest
# promoted build.
#
# If the classfile API is changed but not yet in a promoted build,
# the build might fail and the tool would need the langtools repo
# to build in that case.
#
ifndef LANGTOOLS_TOPDIR
LANGTOOLS_TOPDIR=$(JDK_TOPDIR)/../langtools
endif
LANGTOOLS_TOPDIR_EXISTS := $(shell \
if [ -d $(LANGTOOLS_TOPDIR) ] ; then \
echo true; \
else \
echo false; \
fi)
CLASSFILE_SRC = $(LANGTOOLS_TOPDIR)/src/share/classes
CLASSFILE_PKGDIR = com/sun/tools/classfile
ifeq ($(LANGTOOLS_TOPDIR_EXISTS), true)
FILES_classfile_java := $(shell \
$(CD) $(CLASSFILE_SRC) && \
$(FIND) $(CLASSFILE_PKGDIR) -name '*.java' -print)
FILES_classfile_class = $(FILES_classfile_java:%.java=$(BUILDTOOLCLASSDIR)/%.class)
CLASSFILE_JAR_FILE = $(BUILDTOOLJARDIR)/classfile.jar
BUILDTOOL_JAVAC = $(BOOT_JAVAC_CMD) $(JAVAC_JVM_FLAGS) \
$(BOOT_JAVACFLAGS) -classpath $(CLASSFILE_JAR_FILE)
BUILDTOOL_JAVA = $(BOOT_JAVA_CMD) $(JAVA_TOOLS_FLAGS) \
-Xbootclasspath/p:$(CLASSFILE_JAR_FILE)
else
# if langtools doesn't exist, use tools from the built jdk
BUILDTOOL_JAVAC = $(BINDIR)/javac $(JAVAC_JVM_FLAGS) \
$(BOOT_JAVACFLAGS)
BUILDTOOL_JAVA = $(BINDIR)/java $(JAVA_TOOLS_FLAGS)
endif
# Location of the output modules.list, <module>.classlist
# and other output files generated by the class analyzer tool.
#
MODULE_CLASSLIST = $(MODULES_TEMPDIR)/classlist
all build: classanalyzer gen-classlist
classanalyzer: $(CLASSFILE_JAR_FILE) $(CLASSANALYZER_JAR_FILE)
gen-classlist:
@$(ECHO) ">>>Making "$@" @ `$(DATE)` ..."
@$(RM) -rf $(MODULE_CLASSLIST)
@$(MKDIR) -p $(MODULE_CLASSLIST)
$(BUILDTOOL_JAVA) \
-Dclassanalyzer.debug \
-jar $(CLASSANALYZER_JAR_FILE) \
-jdkhome $(OUTPUTDIR) \
-config ../modules.config \
-config ../modules.group \
-depconfig ../jdk7.depconfig \
-depconfig ../optional.depconfig \
-showdynamic \
-output $(MODULE_CLASSLIST)
@$(ECHO) ">>>Finished making "$@" @ `$(DATE)` ..."
$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE)
@$(prep-target)
$(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@
$(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)/%.class : $(CLASSFILE_SRC)/$(CLASSFILE_PKGDIR)/%.java
@$(prep-target)
@$(BUILDTOOL_JAVAC) \
-sourcepath $(CLASSFILE_SRC) \
-d $(BUILDTOOLCLASSDIR) $<
$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java
@$(prep-target)
$(BUILDTOOL_JAVAC) \
-sourcepath $(BUILDTOOL_SOURCE_ROOT) \
-d $(BUILDTOOLCLASSDIR) $<
$(CLASSANALYZER_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
@$(prep-target)
$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
-C $(BUILDTOOLCLASSDIR) $(PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
@$(java-vm-cleanup)
$(BUILDTOOLJARDIR)/classfile.jar: $(FILES_classfile_class)
@$(prep-target)
$(CD) $(BUILDTOOLCLASSDIR) && \
$(BOOT_JAR_CMD) cf $@ \
$(CLASSFILE_PKGDIR) $(BOOT_JAR_JFLAGS) || $(RM) $@
@$(java-vm-cleanup)
clean clobber::
@$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR)
@$(RM) -rf $(BUILDTOOLCLASSDIR)/$(CLASSFILE_PKGDIR)
@$(RM) $(BUILDTOOL_MANIFEST_FILE)
@$(RM) $(CLASSANALYZER_JAR_FILE)
@$(RM) $(CLASSFILE_JAR_FILE)

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 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.
-->
<project name="classanalyzer" default="build" basedir=".">
</project>

View File

@ -1,86 +0,0 @@
#
# Copyright (c) 2009, 2010, 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.
#
application.title=classanalyzer
application.vendor=mchung
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
cp.extra=${tools.jar}
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/classanalyzer.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.tools.jar=${jdk.home}/lib/tools.jar
file.reference.tools-src=src
includes=**
jar.compress=false
javac.classpath=\
${file.reference.tools.jar}
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=
javadoc.author=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=false
javadoc.use=false
javadoc.version=false
main.class=com.sun.classanalyzer.ClassAnalyzer
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=JDK_1.6
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=-Xmx256m
run.test.classpath=
source.encoding=UTF-8
src.dir=${file.reference.tools-src}

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2009, 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.
-->
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>classanalyzer</name>
<explicit-platform explicit-source-supported="true"/>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots/>
</data>
</configuration>
</project>

View File

@ -1,627 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.Map;
import com.sun.classanalyzer.Module.Reference;
import java.util.LinkedList;
import java.util.TreeMap;
/**
*
* @author Mandy Chung
*/
public abstract class AnnotatedDependency implements Comparable<AnnotatedDependency> {
final Klass from;
final List<String> classes;
protected boolean optional;
String description;
Klass.Method method;
private List<Filter> filters = null;
public AnnotatedDependency(Klass klass) {
this(klass, false);
}
public AnnotatedDependency(Klass klass, boolean optional) {
this.from = klass;
this.classes = new ArrayList<String>();
this.optional = optional;
}
abstract String getTag();
abstract boolean isDynamic();
void setMethod(Klass.Method m) {
this.method = m;
}
void addElement(String element, List<String> value) {
if (element.equals("value")) {
addValue(value);
} else if (element.equals("description")) {
description = value.get(0);
} else if (element.equals("optional")) {
optional = value.get(0).equals("1") || Boolean.parseBoolean(value.get(0));
}
}
void addValue(List<String> value) {
for (String s : value) {
if ((s = s.trim()).length() > 0) {
classes.add(s);
}
}
}
List<String> getValue() {
return classes;
}
boolean isOptional() {
return optional;
}
boolean isEmpty() {
return classes.isEmpty();
}
boolean matches(String classname) {
synchronized (this) {
// initialize filters
if (filters == null) {
filters = new ArrayList<Filter>();
for (String pattern : classes) {
filters.add(new Filter(pattern));
}
}
}
for (Filter f : filters) {
if (f.matches(classname)) {
return true;
}
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (String v : getValue()) {
if (sb.length() == 0) {
sb.append(getTag());
sb.append("\n");
} else {
sb.append("\n");
}
sb.append(" ");
sb.append(from.getClassName()).append(" -> ");
sb.append(v);
}
return sb.toString();
}
@Override
public int compareTo(AnnotatedDependency o) {
if (from == o.from) {
if (this.getClass().getName().equals(o.getClass().getName())) {
String s1 = classes.isEmpty() ? "" : classes.get(0);
String s2 = o.classes.isEmpty() ? "" : o.classes.get(0);
return s1.compareTo(s2);
} else {
return this.getClass().getName().compareTo(o.getClass().getName());
}
} else {
return from.compareTo(o.from);
}
}
@Override
public int hashCode() {
int hashcode = 7 + 73 * from.hashCode();
for (String s : classes) {
hashcode ^= s.hashCode();
}
return hashcode;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof AnnotatedDependency)) {
return false;
}
AnnotatedDependency other = (AnnotatedDependency) obj;
boolean ret = this.from.equals(other.from) && this.classes.size() == other.classes.size();
if (ret == true) {
for (int i = 0; i < this.classes.size(); i++) {
ret = ret && this.classes.get(i).equals(other.classes.get(i));
}
}
return ret;
}
static class ClassForName extends AnnotatedDependency {
public ClassForName(Klass klass, boolean optional) {
super(klass, optional);
}
@Override
String getTag() {
if (this.optional) {
return TAG + "(optional)";
} else {
return TAG;
}
}
@Override
boolean isDynamic() {
return true;
}
static final String TYPE = "sun.annotation.ClassForName";
static final String TAG = "@ClassForName";
}
static class NativeFindClass extends AnnotatedDependency {
public NativeFindClass(Klass klass, boolean optional) {
super(klass, optional);
}
@Override
String getTag() {
if (this.optional) {
return TAG + "(optional)";
} else {
return TAG;
}
}
@Override
boolean isDynamic() {
return true;
}
static final String TYPE = "sun.annotation.NativeFindClass";
static final String TAG = "@NativeFindClass";
}
static class Provider extends AnnotatedDependency {
private List<String> services = new ArrayList<String>();
Provider(Klass klass) {
super(klass, true);
}
@Override
boolean isDynamic() {
return true;
}
public List<String> services() {
return services;
}
@Override
void addElement(String element, List<String> value) {
if (element.equals("service")) {
List<String> configFiles = new ArrayList<String>();
for (String s : value) {
if ((s = s.trim()).length() > 0) {
configFiles.add(metaInfPath + s);
}
}
addValue(configFiles);
}
}
@Override
void addValue(List<String> value) {
for (String s : value) {
if ((s = s.trim()).length() > 0) {
if (s.startsWith("META-INF")) {
services.add(s);
readServiceConfiguration(s, classes);
} else {
throw new RuntimeException("invalid value" + s);
}
}
}
}
boolean isEmpty() {
return services.isEmpty();
}
static final String metaInfPath =
"META-INF" + File.separator + "services" + File.separator;
static void readServiceConfiguration(String config, List<String> names) {
BufferedReader br = null;
try {
InputStream is = ClassPath.open(config);
if (is != null) {
// Properties doesn't perserve the order of the input file
br = new BufferedReader(new InputStreamReader(is, "utf-8"));
int lc = 1;
while ((lc = parseLine(br, lc, names)) >= 0);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
}
// Parse a single line from the given configuration file, adding the name
// on the line to the names list.
//
private static int parseLine(BufferedReader r, int lc, List<String> names) throws IOException {
String ln = r.readLine();
if (ln == null) {
return -1;
}
int ci = ln.indexOf('#');
if (ci >= 0) {
ln = ln.substring(0, ci);
}
ln = ln.trim();
int n = ln.length();
if (n != 0) {
if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0)) {
throw new RuntimeException("Illegal configuration-file syntax");
}
int cp = ln.codePointAt(0);
if (!Character.isJavaIdentifierStart(cp)) {
throw new RuntimeException("Illegal provider-class name: " + ln);
}
for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) {
cp = ln.codePointAt(i);
if (!Character.isJavaIdentifierPart(cp) && (cp != '.')) {
throw new RuntimeException("Illegal provider-class name: " + ln);
}
}
if (!names.contains(ln)) {
names.add(ln);
}
}
return lc + 1;
}
@Override
String getTag() {
return TAG;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof AnnotatedDependency)) {
return false;
}
Provider other = (Provider) obj;
boolean ret = this.from.equals(other.from) &&
this.services.size() == other.services.size();
if (ret == true) {
for (int i = 0; i < this.services.size(); i++) {
ret = ret && this.services.get(i).equals(other.services.get(i));
}
}
return ret;
}
@Override
public int hashCode() {
int hashcode = 7 + 73 * from.hashCode();
for (String s : services) {
hashcode ^= s.hashCode();
}
return hashcode;
}
@Override
public List<String> getValue() {
List<String> result = new ArrayList<String>();
result.addAll(services);
return result;
}
static final String TYPE = "sun.annotation.Provider";
static final String TAG = "@Provider";
}
static class OptionalDependency extends AnnotatedDependency {
static boolean isOptional(Klass from, Klass to) {
synchronized (OptionalDependency.class) {
if (optionalDepsMap == null) {
// Build a map of classes to its optional dependencies
initDependencies();
}
}
for (Reference ref : optionalDepsMap.keySet()) {
if (ref.referrer() == from && ref.referree() == to) {
return true;
}
}
return false;
}
OptionalDependency(Klass klass) {
super(klass, true);
}
@Override
boolean isDynamic() {
return false;
}
@Override
String getTag() {
return TAG;
}
static final String TYPE = "sun.annotation.Optional";
static final String TAG = "@Optional";
}
static class CompilerInline extends AnnotatedDependency {
public CompilerInline(Klass klass) {
super(klass);
}
@Override
String getTag() {
return TAG;
}
@Override
boolean isDynamic() {
return false;
}
static final String TYPE = "sun.annotation.Inline";
static final String TAG = "@Inline";
}
static class Filter {
final String pattern;
final String regex;
Filter(String pattern) {
this.pattern = pattern;
boolean isRegex = false;
for (int i = 0; i < pattern.length(); i++) {
char p = pattern.charAt(i);
if (p == '*' || p == '[' || p == ']') {
isRegex = true;
break;
}
}
if (isRegex) {
this.regex = convertToRegex(pattern);
} else {
this.regex = null;
}
}
private String convertToRegex(String pattern) {
StringBuilder sb = new StringBuilder();
int i = 0;
int index = 0;
int plen = pattern.length();
while (i < plen) {
char p = pattern.charAt(i);
if (p == '*') {
sb.append("(").append(pattern.substring(index, i)).append(")");
if (i + 1 < plen && pattern.charAt(i + 1) == '*') {
sb.append(".*");
index = i + 2;
} else {
sb.append("[^\\.]*");
index = i + 1;
}
} else if (p == '[') {
int j = i + 1;
while (j < plen) {
if (pattern.charAt(j) == ']') {
break;
}
j++;
}
if (j >= plen || pattern.charAt(j) != ']') {
throw new RuntimeException("Malformed pattern " + pattern);
}
sb.append("(").append(pattern.substring(index, i)).append(")");
sb.append(pattern.substring(i, j + 1));
index = j + 1;
i = j;
}
i++;
}
if (index < plen) {
sb.append("(").append(pattern.substring(index, plen)).append(")");
}
return sb.toString();
}
boolean matches(String name) {
if (regex == null) {
// the pattern is not a regex
return name.equals(pattern);
} else {
return name.matches(regex);
}
}
}
static boolean isValidType(String type) {
if (type.endsWith("(optional)")) {
int len = type.length() - "(optional)".length();
type = type.substring(0, len);
}
return type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG) ||
type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG) ||
type.equals(Provider.TYPE) || type.equals(Provider.TAG) ||
type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG) ||
type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG);
}
static AnnotatedDependency newAnnotatedDependency(String tag, String value, Klass klass) {
AnnotatedDependency dep = newAnnotatedDependency(tag, klass);
if (dep != null) {
dep.addValue(Collections.singletonList(value));
}
return dep;
}
static List<AnnotatedDependency> annotatedDependencies = new LinkedList<AnnotatedDependency>();
static List<AnnotatedDependency> optionalDependencies = new LinkedList<AnnotatedDependency>();
static AnnotatedDependency newAnnotatedDependency(String type, Klass klass) {
boolean optional = false;
if (type.endsWith("(optional)")) {
optional = true;
int len = type.length() - "(optional)".length();
type = type.substring(0, len);
}
if (type.equals(OptionalDependency.TYPE) || type.equals(OptionalDependency.TAG)) {
return newOptionalDependency(klass);
}
AnnotatedDependency dep;
if (type.equals(ClassForName.TYPE) || type.equals(ClassForName.TAG)) {
dep = new ClassForName(klass, optional);
} else if (type.equals(NativeFindClass.TYPE) || type.equals(NativeFindClass.TAG)) {
dep = new NativeFindClass(klass, optional);
} else if (type.equals(Provider.TYPE) || type.equals(Provider.TAG)) {
dep = new Provider(klass);
} else if (type.equals(CompilerInline.TYPE) || type.equals(CompilerInline.TAG)) {
dep = new CompilerInline(klass);
} else {
return null;
}
klass.addAnnotatedDep(dep);
annotatedDependencies.add(dep);
return dep;
}
static OptionalDependency newOptionalDependency(Klass klass) {
OptionalDependency dep = new OptionalDependency(klass);
optionalDependencies.add(dep);
return dep;
}
static Map<Reference, Set<AnnotatedDependency>> annotatedDepsMap = null;
static Map<Reference, Set<AnnotatedDependency>> optionalDepsMap = null;
static Map<Reference, Set<AnnotatedDependency>> getReferences(Module m) {
// ensure it's initialized
initDependencies();
Map<Reference, Set<AnnotatedDependency>> result = new TreeMap<Reference, Set<AnnotatedDependency>>();
for (Reference ref : annotatedDepsMap.keySet()) {
if (m.contains(ref.referrer()) && m.isModuleDependence(ref.referree())) {
result.put(ref, annotatedDepsMap.get(ref));
}
}
return result;
}
static Set<Module.Dependency> getDependencies(Module m) {
// ensure it's initialized
initDependencies();
Set<Module.Dependency> deps = new TreeSet<Module.Dependency>();
for (Reference ref : annotatedDepsMap.keySet()) {
if (m.contains(ref.referrer())) {
Module other = m.getModuleDependence(ref.referree());
if (other != null) {
for (AnnotatedDependency ad : annotatedDepsMap.get(ref)) {
Module.Dependency d = new Module.Dependency(other, ad.isOptional(), ad.isDynamic());
deps.add(d);
}
}
}
}
return deps;
}
synchronized static void initDependencies() {
if (annotatedDepsMap != null) {
return;
}
// Build a map of references to its dependencies
annotatedDepsMap = new TreeMap<Reference, Set<AnnotatedDependency>>();
optionalDepsMap = new TreeMap<Reference, Set<AnnotatedDependency>>();
for (Klass k : Klass.getAllClasses()) {
for (AnnotatedDependency ad : annotatedDependencies) {
if (ad.matches(k.getClassName())) {
Reference ref = new Reference(ad.from, k);
Set<AnnotatedDependency> set = annotatedDepsMap.get(ref);
if (set == null) {
set = new TreeSet<AnnotatedDependency>();
annotatedDepsMap.put(ref, set);
}
set.add(ad);
}
}
for (AnnotatedDependency ad : optionalDependencies) {
if (ad.matches(k.getClassName())) {
Reference ref = new Reference(ad.from, k);
Set<AnnotatedDependency> set = optionalDepsMap.get(ref);
if (set == null) {
set = new TreeSet<AnnotatedDependency>();
optionalDepsMap.put(ref, set);
}
set.add(ad);
}
}
}
}
}

View File

@ -1,293 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.tools.classfile.*;
import com.sun.tools.classfile.Annotation;
import com.sun.tools.classfile.ExtendedAnnotation;
import com.sun.tools.classfile.Annotation.Annotation_element_value;
import com.sun.tools.classfile.Annotation.Array_element_value;
import com.sun.tools.classfile.Annotation.Class_element_value;
import com.sun.tools.classfile.Annotation.Enum_element_value;
import com.sun.tools.classfile.Annotation.Primitive_element_value;
import com.sun.tools.classfile.ConstantPoolException;
import com.sun.tools.classfile.Descriptor;
import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
import java.util.ArrayList;
import java.util.List;
import com.sun.classanalyzer.AnnotatedDependency.*;
import java.io.File;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Set;
/**
*
* @author Mandy Chung
*/
public class AnnotationParser {
static boolean parseAnnotation = false;
static void setParseAnnotation(boolean newValue) {
parseAnnotation = newValue;
}
private final ClassFileParser cfparser;
public AnnotationParser(ClassFileParser cfparser) {
this.cfparser = cfparser;
}
private AnnotatedDependency addAnnotation(Annotation annot, Klass.Method method) {
String type = getType(annot.type_index);
AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, cfparser.this_klass);
if (dep != null) {
for (int i = 0; i < annot.num_element_value_pairs; i++) {
Element element = getElement(annot.element_value_pairs[i]);
dep.addElement(element.name, element.value);
}
dep.setMethod(method);
}
return dep;
}
private AnnotatedDependency addAnnotation(ExtendedAnnotation annot, Klass.Method method) {
return addAnnotation(annot.annotation, method);
}
class Element {
String name;
List<String> value;
Element(String name) {
this.name = name;
this.value = new ArrayList<String>();
}
void add(String v) {
value.add(v);
}
}
Element getElement(Annotation.element_value_pair pair) {
Element element = new Element(getName(pair.element_name_index));
evp.parse(pair.value, element);
return element;
}
private String getType(int index) {
try {
Descriptor d = new Descriptor(index);
return d.getFieldType(cfparser.classfile.constant_pool);
} catch (ConstantPoolException ignore) {
} catch (InvalidDescriptor ignore) {
}
return "Unknown";
}
private String getName(int index) {
return cfparser.constantPoolParser.stringValue(index);
}
element_value_Parser evp = new element_value_Parser();
class element_value_Parser implements Annotation.element_value.Visitor<Void, Element> {
public Void parse(Annotation.element_value value, Element element) {
value.accept(this, element);
return null;
}
public Void visitPrimitive(Primitive_element_value ev, Element element) {
String value = getName(ev.const_value_index);
element.add(value);
return null;
}
public Void visitEnum(Enum_element_value ev, Element element) {
String value = getName(ev.type_name_index) + "." + getName(ev.const_name_index);
element.add(value);
return null;
}
public Void visitClass(Class_element_value ev, Element element) {
String value = getName(ev.class_info_index) + ".class";
element.add(value);
return null;
}
public Void visitAnnotation(Annotation_element_value ev, Element element) {
// AnnotationParser.this.addAnnotation(ev.annotation_value);
throw new UnsupportedOperationException("Not supported: " + ev);
}
public Void visitArray(Array_element_value ev, Element element) {
for (int i = 0; i < ev.num_values; i++) {
parse(ev.values[i], element);
}
return null;
}
}
void parseAttributes(Attributes attributes, Klass.Method method) {
if (!parseAnnotation) {
return;
}
visitRuntimeAnnotations((RuntimeVisibleAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleAnnotations), method);
visitRuntimeAnnotations((RuntimeInvisibleAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleAnnotations), method);
visitRuntimeTypeAnnotations((RuntimeVisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleTypeAnnotations), method);
visitRuntimeTypeAnnotations((RuntimeInvisibleTypeAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleTypeAnnotations), method);
visitRuntimeParameterAnnotations((RuntimeVisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeVisibleParameterAnnotations), method);
visitRuntimeParameterAnnotations((RuntimeInvisibleParameterAnnotations_attribute) attributes.get(Attribute.RuntimeInvisibleParameterAnnotations), method);
}
public void visitRuntimeAnnotations(RuntimeAnnotations_attribute attr, Klass.Method method) {
if (attr == null) {
return;
}
for (int i = 0; i < attr.annotations.length; i++) {
addAnnotation(attr.annotations[i], method);
}
}
public void visitRuntimeTypeAnnotations(RuntimeTypeAnnotations_attribute attr, Klass.Method method) {
if (attr == null) {
return;
}
for (int i = 0; i < attr.annotations.length; i++) {
addAnnotation(attr.annotations[i], method);
}
}
public void visitRuntimeParameterAnnotations(RuntimeParameterAnnotations_attribute attr, Klass.Method method) {
if (attr == null) {
return;
}
for (int param = 0; param < attr.parameter_annotations.length; param++) {
for (int i = 0; i < attr.parameter_annotations[param].length; i++) {
addAnnotation(attr.parameter_annotations[param][i], method);
}
}
}
void parseAttributes(Attributes attributes) {
parseAttributes(attributes, null);
}
public static void main(String[] args) throws Exception {
String jdkhome = null;
String output = ".";
// process arguments
int i = 0;
while (i < args.length) {
String arg = args[i++];
if (arg.equals("-jdkhome")) {
if (i < args.length) {
jdkhome = args[i++];
} else {
usage();
}
} else if (arg.equals("-output")) {
output = args[i++];
} else {
usage();
}
}
if (jdkhome == null) {
usage();
}
// parse annotation and code attribute to find all references
// to Class.forName etc
CodeAttributeParser.setParseCodeAttribute(true);
AnnotationParser.setParseAnnotation(true);
ClassPath.setJDKHome(jdkhome);
ClassPath.parseAllClassFiles();
PrintWriter writer = new PrintWriter(new File(output, "jdk7.depconfig"));
try {
for (Klass k : Klass.getAllClasses()) {
for (AnnotatedDependency dep : k.getAnnotatedDeps()) {
if (dep.isEmpty()) {
continue;
}
writer.format("# %s \n", dep.method == null ? dep.from : dep.method);
writer.format("%s\n\n", dep);
}
}
} finally {
writer.close();
}
writer = new PrintWriter(new File(output, "optional.depconfig"));
try {
AnnotatedDependency prev = null;
for (AnnotatedDependency dep : AnnotatedDependency.optionalDependencies) {
if (prev != null && !dep.equals(prev)) {
writer.format("%s\n\n", prev);
}
writer.format("# %s \n", dep.method == null ? dep.from : dep.method);
prev = dep;
}
if (prev != null) {
writer.format("%s\n\n", prev);
}
} finally {
writer.close();
}
writer = new PrintWriter(new File(output, "runtime.references"));
try {
for (Map.Entry<String, Set<Klass.Method>> entry : CodeAttributeParser.runtimeReferences.entrySet()) {
writer.format("References to %s\n", entry.getKey());
Klass prev = null;
for (Klass.Method m : entry.getValue()) {
if (prev == null || prev != m.getKlass()) {
writer.format(" %-50s # %s\n", m.getKlass(), m);
} else if (prev == m.getKlass()) {
writer.format(" %-50s # %s\n", "", m);
}
prev = m.getKlass();
}
}
} finally {
writer.close();
}
}
private static void usage() {
System.out.println("Usage: AnnotationParser <options>");
System.out.println("Options: ");
System.out.println("\t-jdkhome <JDK home> where all jars will be parsed");
System.out.println("\t-depconfig <output file for annotated dependencies>");
System.out.println("\t-optional <output file for optional dependencies>");
System.exit(-1);
}
}

View File

@ -1,819 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.File;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.sun.tools.classfile.*;
import com.sun.tools.classfile.ConstantPool.*;
import static com.sun.tools.classfile.ConstantPool.*;
import com.sun.tools.classfile.Instruction.TypeKind;
import com.sun.tools.classfile.Type.*;
/**
* Generate the module config for the boot module with
* a given set of roots (classes or methods) and exclude list.
*
* This tool does method-level dependency analysis starting
* from the root set and follows references transitively as follows:
* <ul>
* <li>For a given class, it will parse the ClassFile to
* find its superclass and superinterfaces and also
* its static initializer &lt;clinit&gt;.</li>
* <li>For each method, it will parse its Code attribute
* to look for a Methodref, Fieldref, and InterfaceMethodref.
* </li>
* <li>For each Fieldref, it will include the type of
* the field in the dependency.</li>
* <li>For each MethodRef, it will follow all references in
* that method.</li>
* <li>For each InterfaceMethodref, it will follow all references in
* that method defined its implementation classes in
* the resulting dependency list.</li>
* </ul>
*
* Limitation:
* <ul>
* <li>For each Methodref, it only parses the method of
* the specified type. It doesn't analyze the class hierarchy
* and follow references of its subclasses since it ends up
* pulls in many unnecessary dependencies. For now,
* the list of subclasses and methods need to be listed in
* the root set.</li>
* </ul>
*
* @author Mandy Chung
*/
public class BootAnalyzer {
public static void main(String[] args) throws Exception {
String jdkhome = null;
String config = null;
String output = ".";
boolean printClassList = false;
// process arguments
int i = 0;
while (i < args.length) {
String arg = args[i++];
if (arg.equals("-jdkhome")) {
if (i < args.length) {
jdkhome = args[i++];
} else {
usage();
}
} else if (arg.equals("-config")) {
config = args[i++];
} else if (arg.equals("-output")) {
output = args[i++];
} else if (arg.equals("-classlist")) {
printClassList = true;
} else {
usage();
}
}
if (jdkhome == null || config == null) {
usage();
}
File jre = new File(jdkhome, "jre");
if (jre.exists()) {
ClassPath.setJDKHome(jdkhome);
} else {
File classes = new File(jdkhome, "classes");
if (classes.exists()) {
ClassPath.setClassPath(classes.getCanonicalPath());
} else {
throw new RuntimeException("Invalid jdkhome: " + jdkhome);
}
}
parseConfigFile(config);
followRoots();
// create output directory if it doesn't exist
File dir = new File(output);
if (!dir.isDirectory()) {
if (!dir.exists()) {
boolean created = dir.mkdir();
if (!created) {
throw new RuntimeException("Unable to create `" + dir + "'");
}
}
}
String bootmodule = "boot";
String bootconfig = resolve(dir, bootmodule, "config");
printBootConfig(bootconfig, bootmodule);
List<ModuleConfig> list = ModuleConfig.readConfigurationFile(bootconfig);
Module module = Module.addModule(list.get(0));
for (Klass k : Klass.getAllClasses()) {
module.addKlass(k);
}
module.fixupDependencies();
if (printClassList) {
module.printClassListTo(resolve(dir, bootmodule, "classlist"));
module.printSummaryTo(resolve(dir, bootmodule, "summary"));
}
}
// print boot.config file as an input to the ClassAnalyzer
private static void printBootConfig(String output, String bootmodule) throws IOException {
File f = new File(output);
PrintWriter writer = new PrintWriter(f);
try {
int count = 0;
writer.format("module %s {%n", bootmodule);
for (Klass k : Klass.getAllClasses()) {
if (count++ == 0) {
writer.format("%4s%7s %s", "", "include", k);
} else {
writer.format(",%n");
writer.format("%4s%7s %s", "", "", k);
}
}
writer.format(";%n}%n");
} finally {
writer.close();
}
}
private static String resolve(File dir, String mname, String suffix) {
File f = new File(dir, mname + "." + suffix);
return f.toString();
}
static List<MethodDescriptor> methods = new LinkedList<MethodDescriptor>();
static Deque<MethodDescriptor> pending = new ArrayDeque<MethodDescriptor>();
static Deque<MethodDescriptor> interfaceMethodRefs = new ArrayDeque<MethodDescriptor>();
static Filter filter = new Filter();
private static void followRoots() throws IOException {
MethodDescriptor md = null;
while ((md = pending.poll()) != null) {
if (!methods.contains(md)) {
methods.add(md);
if (md.classname.isEmpty()) {
trace("Warning: class missing %s%n", md);
continue;
}
if (filter.isExcluded(md.classname)) {
trace("excluded %s%n", md);
} else {
KlassInfo kinfo = getKlassInfo(md.classname);
if (kinfo.classname.contains("$")) {
int pos = kinfo.classname.lastIndexOf('$');
String outer = kinfo.classname.substring(0, pos);
if (!cache.containsKey(outer)) {
trace(" include outer class %s%n", outer);
getKlassInfo(outer).ensureParse();
}
}
kinfo.ensureParse();
if (md.methodname.length() > 0) {
if (filter.isExcluded(md.name)) {
trace("excluded %s%n", md);
} else {
if (md.interfaceMethodRef) {
trace("interface methodref %s%n", md);
interfaceMethodRefs.add(md);
} else {
List<String> descriptors = kinfo.parse(md);
if (descriptors.isEmpty()) {
if (kinfo.getSuperclass() != null) {
String sn = kinfo.getSuperclass().classname;
MethodDescriptor superMD = new MethodDescriptor(sn + "." + md.methodname, md.descriptor, false);
if (!methods.contains(superMD) && !pending.contains(superMD)) {
trace(" delegated %s to %s%n", md, superMD);
pending.add(superMD);
}
} else if (kinfo.isClass()) {
trace(" %s (not found)%n", md);
} else {
trace(" %s (interface)%n", md);
}
} else {
if (md.descriptor.equals("*")) {
trace(" parsed %s : ", md.name);
for (String s : descriptors) {
trace(" %s", s);
}
trace("%n");
}
}
}
}
}
}
}
if (pending.isEmpty()) {
for (Klass k : Klass.getAllClasses()) {
if (k.getFileSize() == 0) {
getKlassInfo(k.getClassName()).ensureParse();
}
}
while ((md = interfaceMethodRefs.poll()) != null) {
addSubClassMethods(md);
}
}
}
}
static void addSubClassMethods(MethodDescriptor md) throws IOException {
for (KlassInfo kinfo : getSubClasses(md.classname)) {
String methodname = kinfo.classname + "." + md.methodname;
MethodDescriptor other = new MethodDescriptor(methodname, md.descriptor, false);
if (!methods.contains(other) && !pending.contains(other)) {
trace("Warning: subclass from %s to %s%n", md.classname, other);
pending.add(other);
}
}
}
private final static String privilegedActionInterf = "java.security.PrivilegedAction";
private final static String privilegedExceptionActionInterf = "java.security.PrivilegedExceptionAction";
static boolean isPrivilegedAction(String classname) {
if (classname.isEmpty()) {
return false;
}
KlassInfo kinfo = getKlassInfo(classname);
for (KlassInfo ki : kinfo.getInterfaces()) {
String interf = ki.classname;
if (interf.equals(privilegedActionInterf) ||
interf.equals(privilegedExceptionActionInterf)) {
return true;
}
}
return false;
}
static Map<String, KlassInfo> cache = new HashMap<String, KlassInfo>();
static KlassInfo getKlassInfo(String classname) {
classname = classname.replace('/', '.');
KlassInfo kinfo = cache.get(classname);
if (kinfo == null) {
kinfo = new KlassInfo(classname);
cache.put(classname, kinfo);
}
return kinfo;
}
static class KlassInfo {
final String classname;
private ClassFileParser parser;
private KlassInfo superclass;
private List<KlassInfo> interfaces = new LinkedList<KlassInfo>();
KlassInfo(String classname) {
this.classname = classname;
}
boolean isClass() {
ensureParse();
return parser.classfile.isClass();
}
KlassInfo getSuperclass() {
ensureParse();
return superclass;
}
List<KlassInfo> getInterfaces() {
ensureParse();
return java.util.Collections.unmodifiableList(interfaces);
}
void ensureParse() {
try {
getClassFileParser();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
synchronized ClassFileParser getClassFileParser() throws IOException {
if (parser == null) {
parser = ClassPath.parserForClass(classname);
if (parser != null) {
parseClassFile();
List<String> descriptors = parse(new MethodDescriptor(classname + ".<clinit>", "()V", false));
}
}
return parser;
}
List<String> parse(MethodDescriptor md) {
ensureParse();
try {
List<String> descriptors = new LinkedList<String>();
for (Method m : parser.classfile.methods) {
String name = m.getName(parser.classfile.constant_pool);
String desc = parser.constantPoolParser.getDescriptor(m.descriptor.index);
if (name.equals(md.methodname)) {
if (md.descriptor.equals("*") || md.descriptor.equals(desc)) {
parseMethod(parser, m);
descriptors.add(desc);
}
}
}
return descriptors;
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
private void parseClassFile() throws IOException {
parser.parseClassInfo();
ClassFile classfile = parser.classfile;
try {
if (classfile.super_class > 0) {
superclass = getKlassInfo(classfile.getSuperclassName());
}
if (classfile.interfaces != null) {
for (int i = 0; i < classfile.interfaces.length; i++) {
interfaces.add(getKlassInfo(classfile.getInterfaceName(i)));
}
}
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
}
static List<KlassInfo> getSubClasses(String classname) throws IOException {
List<KlassInfo> result = new LinkedList<KlassInfo>();
List<KlassInfo> list = new LinkedList<KlassInfo>();
list.addAll(cache.values());
for (KlassInfo kinfo : list) {
if (kinfo.getSuperclass() != null && classname.equals(kinfo.getSuperclass().classname)) {
result.add(kinfo);
}
for (KlassInfo interf : kinfo.getInterfaces()) {
if (classname.equals(interf.classname)) {
result.add(kinfo);
}
}
}
return result;
}
private static void parseConfigFile(String config) throws IOException {
FileInputStream in = new FileInputStream(config);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
int lineNumber = 0;
while ((line = reader.readLine()) != null) {
lineNumber++;
if ((line = line.trim()).length() > 0) {
if (line.startsWith("#")) {
continue;
}
String[] s = line.split("\\s+");
if ("exclude".equals(s[0])) {
filter.exclude(s[1]);
} else {
String name = s[0].replace('/', '.');
if (name.length() > 0) {
String classname = name.replace('/', '.');
if (s.length == 2) {
// method name
int pos = classname.lastIndexOf('.');
classname = classname.substring(0, pos);
}
KlassInfo kinfo = getKlassInfo(classname);
if (kinfo.getClassFileParser() != null) {
// class exists
MethodDescriptor md = (s.length == 1) ? new MethodDescriptor(name) : new MethodDescriptor(name, s[1], false);
if (!pending.contains(md)) {
pending.add(md);
}
} else {
// class not found
trace("Class %s not found%n", classname);
}
}
}
}
}
} finally {
in.close();
}
}
private static void parseMethod(ClassFileParser cfparser, Method m) {
Klass.Method kmethod = cfparser.parseMethod(m);
Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
if (c_attr != null) {
LineNumberTable_attribute lineNumTable =
(LineNumberTable_attribute) c_attr.attributes.get(Attribute.LineNumberTable);
InstructorVisitor visitor = new InstructorVisitor(cfparser, lineNumTable);
trace("parseMethod %s %s %n", cfparser.this_klass, kmethod);
for (Instruction instr : c_attr.getInstructions()) {
try {
instr.accept(visitor, kmethod);
} catch (ArrayIndexOutOfBoundsException e) {
throw new RuntimeException("error at or after byte " + instr.getPC());
}
}
if (c_attr.exception_table_langth > 0) {
for (int i = 0; i <
c_attr.exception_table.length; i++) {
Code_attribute.Exception_data handler = c_attr.exception_table[i];
int catch_type = handler.catch_type;
if (catch_type > 0) {
visitor.addConstantPoolRef(catch_type, kmethod, handler.start_pc);
}
}
}
}
}
static class MethodDescriptor {
final String name;
final String classname;
final String methodname;
final String descriptor;
final boolean interfaceMethodRef;
MethodDescriptor(String classname) {
this.classname = classname.replace('/', '.');
this.name = this.classname;
this.methodname = "";
this.descriptor = "";
this.interfaceMethodRef = false;
if (this.classname.length() == 1) {
throw new RuntimeException("invalid " + this);
}
}
MethodDescriptor(String name, String descriptor, boolean interfaceMethodRef) {
name = name.replace('/', '.');
this.name = name;
int pos = name.lastIndexOf('.');
this.classname = name.substring(0, pos);
this.methodname = name.substring(pos + 1, name.length());
this.descriptor = descriptor;
this.interfaceMethodRef = interfaceMethodRef;
if (this.classname.length() == 1) {
throw new RuntimeException("invalid " + this);
}
}
@Override
public boolean equals(Object obj) {
MethodDescriptor m = (MethodDescriptor) obj;
return this.name.equals(m.name) &&
this.descriptor.equals(m.descriptor);
}
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 97 * hash + (this.descriptor != null ? this.descriptor.hashCode() : 0);
return hash;
}
public String toString() {
if (descriptor.isEmpty()) {
return name;
} else {
return name + " : " + descriptor;
}
}
}
static class Filter {
private Set<String> excludes = new TreeSet<String>();
Filter exclude(String pattern) {
excludes.add(pattern);
return this;
}
boolean isExcluded(String klass) {
for (String pattern : excludes) {
if (matches(klass, pattern)) {
return true;
}
}
return false;
}
private boolean matches(String klass, String pattern) {
int pos = klass.lastIndexOf('.');
String packageName = pos > 0 ? klass.substring(0, pos) : "<unnamed>";
if (pattern.endsWith("**")) {
String p = pattern.substring(0, pattern.length() - 2);
return klass.startsWith(p);
} else if (pattern.endsWith("*")) {
pos = pattern.lastIndexOf('.');
String pkg = pos > 0 ? pattern.substring(0, pos) : "<unnamed>";
if (packageName.equals(pkg)) {
// package name has to be exact match
String p = pattern.substring(0, pattern.length() - 1);
return klass.startsWith(p);
} else {
return false;
}
} else {
// exact match or inner class
return klass.equals(pattern) || klass.startsWith(pattern + "$");
}
}
}
static class InstructorVisitor implements Instruction.KindVisitor<Void, Klass.Method> {
private final ClassFileParser parser;
private final LineNumberTable_attribute lineNumTable;
InstructorVisitor(ClassFileParser parser, LineNumberTable_attribute lineNumTable) {
this.parser = parser;
this.lineNumTable = lineNumTable;
}
int getLineNumber(int pc) {
if (lineNumTable != null) {
int start_pc = 0;
int lineno = 0;
for (int i = 0; i < lineNumTable.line_number_table_length; i++) {
int cur_start_pc = lineNumTable.line_number_table[i].start_pc;
if (pc == 0 && cur_start_pc == 0) {
return lineNumTable.line_number_table[i].line_number;
} else if (pc >= start_pc && pc < cur_start_pc) {
return lineno;
}
start_pc = cur_start_pc;
lineno = lineNumTable.line_number_table[i].line_number;
}
}
return 0;
}
void addConstantPoolRef(int index, Klass.Method m, int pc) {
try {
CPInfo cpInfo = parser.classfile.constant_pool.get(index);
String name = cpInfo.accept(typeFinder, null);
if (name != null) {
trace(" %s %s at line %d%n", parser.constantPoolParser.tagName(index), name, getLineNumber(pc));
}
} catch (InvalidIndex ex) {
throw new RuntimeException(ex);
}
}
public Void visitNoOperands(Instruction instr, Klass.Method m) {
return null;
}
public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) {
return null;
}
public Void visitBranch(Instruction instr, int offset, Klass.Method m) {
return null;
}
public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) {
addConstantPoolRef(index, m, instr.getPC());
return null;
}
public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) {
addConstantPoolRef(index, m, instr.getPC());
return null;
}
public Void visitLocal(Instruction instr, int index, Klass.Method m) {
return null;
}
public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) {
return null;
}
public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) {
return null;
}
public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) {
return null;
}
public Void visitValue(Instruction instr, int value, Klass.Method m) {
return null;
}
public Void visitUnknown(Instruction instr, Klass.Method m) {
return null;
}
private ConstantPool.Visitor<String, Void> typeFinder = new ConstantPool.Visitor<String, Void>() {
String getClassName(CPRefInfo info, Void p) {
try {
return parser.checkClassName(info.getClassName()).replace('/', '.');
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
boolean addReferencedClass(String name) {
if (Klass.findKlass(name) == null) {
MethodDescriptor md = new MethodDescriptor(name);
if (!methods.contains(md) && !pending.contains(md)) {
pending.add(md);
}
return true;
}
return false;
}
private String privilegedActionClass = "";
void cachePrivilegedAction(String classname) {
trace(" found PrivilegedAction %s%n", classname);
privilegedActionClass = classname;
}
void doPrivilegedCall(String method) {
if (privilegedActionClass.length() > 0) {
MethodDescriptor md = new MethodDescriptor(privilegedActionClass + ".run", "*", false);
if (!methods.contains(md) && !pending.contains(md)) {
trace(" doPrivileged %s%n", md);
pending.add(md);
}
}
}
private String addMethodDescriptor(CPRefInfo info, Void p) {
try {
String classname = getClassName(info, null);
String method = classname + "." + info.getNameAndTypeInfo().getName();
String descriptor = info.getNameAndTypeInfo().getType();
if (method.endsWith(".<init>") && isPrivilegedAction(classname)) {
cachePrivilegedAction(classname);
}
if (method.equals("java.security.AccessController.doPrivileged")) {
doPrivilegedCall(method);
return method;
}
boolean interfaceMethodRef = info instanceof CONSTANT_InterfaceMethodref_info;
MethodDescriptor md = new MethodDescriptor(method, descriptor, interfaceMethodRef);
if (!methods.contains(md) && !pending.contains(md)) {
pending.add(md);
}
return method;
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
public String visitClass(CONSTANT_Class_info info, Void p) {
try {
String classname = parser.checkClassName(info.getName()).replace('/', '.');
if (classname.length() > 0) {
addReferencedClass(classname);
}
return classname;
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
public String visitDouble(CONSTANT_Double_info info, Void p) {
// skip
return null;
}
public String visitFieldref(CONSTANT_Fieldref_info info, Void p) {
try {
String classname = getClassName(info, p);
if (classname.length() > 0) {
addReferencedClass(classname);
}
String type = info.getNameAndTypeInfo().getType();
String fieldType = parser.checkClassName(type).replace('/', '.');
if (fieldType.length() > 0) {
addReferencedClass(classname);
}
return parser.constantPoolParser.stringValue(info);
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
public String visitFloat(CONSTANT_Float_info info, Void p) {
// skip
return null;
}
public String visitInteger(CONSTANT_Integer_info info, Void p) {
// skip
return null;
}
public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
return addMethodDescriptor(info, p);
}
public String visitLong(CONSTANT_Long_info info, Void p) {
// skip
return null;
}
public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
// skip
return null;
}
public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
return addMethodDescriptor(info, p);
}
public String visitString(CONSTANT_String_info info, Void p) {
// skip
return null;
}
public String visitUtf8(CONSTANT_Utf8_info info, Void p) {
return null;
}
};
}
static boolean traceOn = System.getProperty("classanalyzer.debug") != null;
private static void trace(String format, Object... args) {
if (traceOn) {
System.out.format(format, args);
}
}
private static void usage() {
System.out.println("Usage: BootAnalyzer <options>");
System.out.println("Options: ");
System.out.println("\t-jdkhome <JDK home> where all jars will be parsed");
System.out.println("\t-config <roots for the boot module>");
System.out.println("\t-output <output dir>");
System.out.println("\t-classlist print class list and summary");
System.exit(-1);
}
}

View File

@ -1,181 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.*;
import java.util.*;
/**
* A simple tool to check module dependencies against a known list of
* dependencies. The tool fails (by throwing a RuntimeException) is an
* unexpected dependency is detected.
*/
public class CheckDeps {
/**
* Represents a dependency from one module to another module. The dependency
* may be optional.
*/
static class Dependency {
private final String module;
private final String other;
private final boolean optional;
private Dependency(String module, String other, boolean optional) {
this.module = module;
this.other = other;
this.optional = optional;
}
String module() { return module; }
String other() { return other; }
boolean isOptional() { return optional; }
/**
* Parses a dependency in one of the following forms:
* a -> b
* [optional] a -> b
*/
static Dependency fromString(String s) {
String[] components = s.split(" ");
int count = components.length;
if (count != 3 && count != 4)
throw new IllegalArgumentException(s);
boolean optional = (count == 4);
if (optional && !components[0].equals("[optional]"))
throw new IllegalArgumentException(s);
String arrow = optional ? components[2] : components[1];
if (!arrow.equals("->"))
throw new IllegalArgumentException(s);
String module = optional ? components[1] : components[0];
String other = optional ? components[3] : components[2];
return new Dependency(module, other, optional);
}
@Override public String toString() {
StringBuilder sb = new StringBuilder();
if (optional)
sb.append("[optional] ");
sb.append(module);
sb.append(" -> ");
sb.append(other);
return sb.toString();
}
}
/**
* Represents the "tail"
*/
static class DependencyTail {
private final String module;
private final boolean optional;
DependencyTail(String module, boolean optional) {
this.module = module;
this.optional = optional;
}
String module() { return module; }
boolean isOptional() { return optional; }
}
static void usage() {
System.out.println("java CheckDeps file1 file2");
System.out.println(" where file1 is the expected dependencies and file2 is");
System.out.println(" the actual dependencies. Both files are assumed to be");
System.out.println(" in modules.summary format (see ClassAnalyzer tool).");
System.out.println();
System.out.println("Example usages:");
System.out.println(" java CheckDeps make/modules/modules.summary " +
"$(OUTPUTDIR)/modules.summary");
System.exit(-1);
}
public static void main(String[] args) throws IOException {
if (args.length != 2)
usage();
// maps a module to the list of modules that it depends on
Map<String,List<DependencyTail>> expected =
new HashMap<String,List<DependencyTail>>();
// parse the expected dependencies file
Scanner s;
s = new Scanner(new FileInputStream(args[0]));
try {
while (s.hasNextLine()) {
Dependency ref = Dependency.fromString(s.nextLine());
if (ref != null) {
String module = ref.module();
List<DependencyTail> list = expected.get(module);
if (list == null) {
list = new ArrayList<DependencyTail>();
expected.put(module, list);
}
list.add(new DependencyTail(ref.other(), ref.isOptional()));
}
}
} finally {
s.close();
}
// parse the actual dependencies file, checking each dependency
// against the expected list.
boolean fail = false;
s = new Scanner(new FileInputStream(args[1]));
try {
while (s.hasNextLine()) {
Dependency dep = Dependency.fromString(s.nextLine());
// check if this dependency is expected
List<DependencyTail> list = expected.get(dep.module());
DependencyTail tail = null;
if (list != null) {
for (DependencyTail t: list) {
if (t.module().equals(dep.other())) {
tail = t;
break;
}
}
}
if (tail == null) {
System.err.println("Unexpected dependency: " + dep);
fail = true;
} else {
// hard dependency when optional dependency is expected
if (tail.isOptional() != dep.isOptional()) {
if (tail.isOptional()) {
System.err.println("Unexpected dependency: " + dep);
fail = true;
}
}
}
}
} finally {
s.close();
}
if (fail)
throw new RuntimeException("Unexpected dependencies found");
}
}

View File

@ -1,354 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.classanalyzer.AnnotatedDependency.*;
import com.sun.classanalyzer.Module.Dependency;
import com.sun.classanalyzer.Module.PackageInfo;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
/**
*
* @author Mandy Chung
*/
public class ClassAnalyzer {
public static void main(String[] args) throws Exception {
String jdkhome = null;
String cpath = null;
List<String> configs = new ArrayList<String>();
List<String> depconfigs = new ArrayList<String>();
String output = ".";
boolean mergeModules = true;
boolean showDynamic = false;
// process arguments
int i = 0;
while (i < args.length) {
String arg = args[i++];
if (arg.equals("-jdkhome")) {
if (i < args.length) {
jdkhome = args[i++];
} else {
usage();
}
} else if (arg.equals("-cpath")) {
if (i < args.length) {
cpath = args[i++];
} else {
usage();
}
} else if (arg.equals("-config")) {
if (i < args.length) {
configs.add(args[i++]);
} else {
usage();
}
} else if (arg.equals("-depconfig")) {
if (i < args.length) {
depconfigs.add(args[i++]);
} else {
usage();
}
} else if (arg.equals("-output")) {
if (i < args.length) {
output = args[i++];
} else {
usage();
}
} else if (arg.equals("-base")) {
ModuleConfig.setBaseModule(args[i++]);
} else if (arg.equals("-nomerge")) {
// analyze the fine-grained module dependencies
mergeModules = false;
} else if (arg.equals("-showdynamic")) {
showDynamic = true;
} else {
System.err.println("Invalid option: " + arg);
usage();
}
}
if ((jdkhome == null && cpath == null) || (jdkhome != null && cpath != null)) {
usage();
}
if (configs.isEmpty()) {
usage();
}
if (jdkhome != null) {
ClassPath.setJDKHome(jdkhome);
} else if (cpath != null) {
ClassPath.setClassPath(cpath);
}
// create output directory if it doesn't exist
File dir = new File(output);
if (!dir.isDirectory()) {
if (!dir.exists()) {
boolean created = dir.mkdir();
if (!created) {
throw new RuntimeException("Unable to create `" + dir + "'");
}
}
}
buildModules(configs, depconfigs, mergeModules);
// generate output files
for (Module m : modules) {
// only generate reports for top-level modules
if (m.group() == m) {
m.printClassListTo(resolve(dir, m.name(), "classlist"));
m.printResourceListTo(resolve(dir, m.name(), "resources"));
m.printSummaryTo(resolve(dir, m.name(), "summary"));
m.printDependenciesTo(resolve(dir, m.name(), "dependencies"), showDynamic);
}
}
// Generate other summary reports
printModulesSummary(dir, showDynamic);
printModulesDot(dir, showDynamic);
printModulesList(dir);
printPackagesSummary(dir);
}
private static List<Module> modules = new ArrayList<Module>();
static void buildModules(List<String> configs,
List<String> depconfigs,
boolean mergeModules) throws IOException {
// create modules based on the input config files
for (String file : configs) {
for (ModuleConfig mconfig : ModuleConfig.readConfigurationFile(file)) {
modules.add(Module.addModule(mconfig));
}
}
// parse class files
ClassPath.parseAllClassFiles();
// Add additional dependencies if specified
if (depconfigs != null && depconfigs.size() > 0) {
DependencyConfig.parse(depconfigs);
}
// process the roots and dependencies to get the classes for each module
for (Module m : modules) {
m.processRootsAndReferences();
}
// update the dependencies for classes that were subsequently allocated
// to modules
for (Module m : modules) {
m.fixupDependencies();
}
if (mergeModules) {
Module.buildModuleMembers();
}
}
private static void printModulesSummary(File dir, boolean showDynamic) throws IOException {
// print summary of dependencies
PrintWriter writer = new PrintWriter(new File(dir, "modules.summary"));
try {
for (Module m : modules) {
// only show top-level module dependencies
if (m.group() == m) {
for (Dependency dep : m.dependents()) {
if (!showDynamic && dep.dynamic && dep.optional) {
continue;
}
if (dep.module == null || !dep.module.isBase()) {
String prefix = "";
if (dep.optional) {
if (dep.dynamic) {
prefix = "[dynamic] ";
} else {
prefix = "[optional] ";
}
}
Module other = dep != null ? dep.module : null;
writer.format("%s%s -> %s%n", prefix, m, other);
}
}
}
}
} finally {
writer.close();
}
}
private static void printModulesDot(File dir, boolean showDynamic) throws IOException {
PrintWriter writer = new PrintWriter(new File(dir, "modules.dot"));
try {
writer.println("digraph jdk {");
for (Module m : modules) {
if (m.group() == m) {
for (Dependency dep : m.dependents()) {
if (!showDynamic && dep.dynamic && dep.optional) {
continue;
}
if (dep.module == null || !dep.module.isBase()) {
String style = "";
String color = "";
String property = "";
if (dep.optional) {
style = "style=dotted";
}
if (dep.dynamic) {
color = "color=red";
}
if (style.length() > 0 || color.length() > 0) {
String comma = "";
if (style.length() > 0 && color.length() > 0) {
comma = ", ";
}
property = String.format(" [%s%s%s]", style, comma, color);
}
Module other = dep != null ? dep.module : null;
writer.format(" \"%s\" -> \"%s\"%s;%n", m, other, property);
}
}
}
}
writer.println("}");
} finally {
writer.close();
}
}
private static void printMembers(Module m, PrintWriter writer) {
for (Module member : m.members()) {
if (!member.isEmpty()) {
writer.format("%s ", member);
printMembers(member, writer);
}
}
}
private static void printModulesList(File dir) throws IOException {
// print module group / members relationship
PrintWriter writer = new PrintWriter(new File(dir, "modules.list"));
try {
for (Module m : modules) {
if (m.group() == m && !m.isEmpty()) {
writer.format("%s ", m);
printMembers(m, writer);
writer.println();
}
}
} finally {
writer.close();
}
}
private static void printPackagesSummary(File dir) throws IOException {
// print package / module relationship
PrintWriter writer = new PrintWriter(new File(dir, "modules.pkginfo"));
try {
Map<String, Set<Module>> packages = new TreeMap<String, Set<Module>>();
Set<String> splitPackages = new TreeSet<String>();
for (Module m : modules) {
if (m.group() == m) {
for (PackageInfo info : m.getPackageInfos()) {
Set<Module> value = packages.get(info.pkgName);
if (value == null) {
value = new TreeSet<Module>();
packages.put(info.pkgName, value);
} else {
// package in more than one module
splitPackages.add(info.pkgName);
}
value.add(m);
}
}
}
// packages that are splitted among multiple modules
writer.println("Packages splitted across modules:-\n");
writer.format("%-60s %s\n", "Package", "Module");
for (String pkgname : splitPackages) {
writer.format("%-60s", pkgname);
for (Module m : packages.get(pkgname)) {
writer.format(" %s", m);
}
writer.println();
}
writer.println("\nPackage-private dependencies:-");
for (String pkgname : splitPackages) {
for (Klass k : Klass.getAllClasses()) {
if (k.getPackageName().equals(pkgname)) {
Module m = k.getModule();
// check if this klass references a package-private
// class that is in a different module
for (Klass other : k.getReferencedClasses()) {
if (other.getModule() != m &&
!other.isPublic() &&
other.getPackageName().equals(pkgname)) {
String from = k.getClassName() + " (" + m + ")";
writer.format("%-60s -> %s (%s)\n", from, other, other.getModule());
}
}
}
}
}
} finally {
writer.close();
}
}
private static String resolve(File dir, String mname, String suffix) {
File f = new File(dir, mname + "." + suffix);
return f.toString();
}
private static void usage() {
System.out.println("Usage: ClassAnalyzer <options>");
System.out.println("Options: ");
System.out.println("\t-jdkhome <JDK home> where all jars will be parsed");
System.out.println("\t-cpath <classpath> where classes and jars will be parsed");
System.out.println("\t Either -jdkhome or -cpath option can be used.");
System.out.println("\t-config <module config file>");
System.out.println("\t This option can be repeated for multiple module config files");
System.out.println("\t-output <output dir>");
System.out.println("\t-nomerge specify not to merge modules");
System.out.println("\t-showdynamic show dynamic dependencies in the reports");
System.exit(-1);
}
}

View File

@ -1,629 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.tools.classfile.*;
import com.sun.tools.classfile.Type.*;
import com.sun.tools.classfile.Descriptor.InvalidDescriptor;
import static com.sun.tools.classfile.AccessFlags.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/**
*
* @author Mandy Chung
*/
public class ClassFileParser {
final Klass this_klass;
final ClassFile classfile;
final ConstantPoolParser constantPoolParser;
final AnnotationParser annotationParser;
final CodeAttributeParser codeAttributeParser;
private final boolean buildDeps;
protected ClassFileParser(InputStream in, long size, boolean buildDeps) throws IOException {
try {
this.classfile = ClassFile.read(in);
this.this_klass = getKlass(this.classfile);
this.buildDeps = buildDeps;
this.constantPoolParser = new ConstantPoolParser(this);
this.annotationParser = new AnnotationParser(this);
this.codeAttributeParser = new CodeAttributeParser(this);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
private Klass getKlass(ClassFile cf) throws ConstantPoolException {
Klass k = Klass.getKlass(cf.getName());
k.setAccessFlags(cf.access_flags.flags);
k.setFileSize(cf.byteLength());
return k;
}
public static ClassFileParser newParser(InputStream in, long size, boolean buildDeps) throws IOException {
return new ClassFileParser(in, size, buildDeps);
}
public static ClassFileParser newParser(String classPathname, boolean buildDeps) throws IOException {
return newParser(new File(classPathname), buildDeps);
}
public static ClassFileParser newParser(File f, boolean buildDeps) throws IOException {
BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
try {
return newParser(in, f.length(), buildDeps);
} finally {
in.close();
}
}
public void parseDependency(boolean publicAPIs) throws IOException {
if (publicAPIs && !classfile.access_flags.is(ACC_PUBLIC)) {
// process public APIs only
return;
}
parseClassInfo();
if (!publicAPIs) {
// parse all references in the classfile
constantPoolParser.parseDependency();
}
parseMethods(publicAPIs);
parseFields(publicAPIs);
}
void parseClassInfo() throws IOException {
ConstantPool cpool = classfile.constant_pool;
try {
Signature_attribute sigAttr = (Signature_attribute) classfile.attributes.get(Attribute.Signature);
if (sigAttr == null) {
// use info from class file header
if (classfile.isClass() && classfile.super_class != 0) {
String sn = classfile.getSuperclassName();
addExtends(sn);
}
for (int i = 0; i < classfile.interfaces.length; i++) {
String interf = classfile.getInterfaceName(i);
if (classfile.isClass()) {
addImplements(interf);
} else {
addExtends(interf);
}
}
} else {
Type t = sigAttr.getParsedSignature().getType(cpool);
// The signature parser cannot disambiguate between a
// FieldType and a ClassSignatureType that only contains a superclass type.
if (t instanceof Type.ClassSigType) {
Type.ClassSigType cst = Type.ClassSigType.class.cast(t);
if (cst.superclassType != null) {
for (Klass k : getKlass(cst.superclassType)) {
addExtends(k);
}
}
if (cst.superinterfaceTypes != null) {
for (Type t1 : cst.superinterfaceTypes) {
for (Klass k : getKlass(t1)) {
addImplements(k);
}
}
}
} else {
for (Klass k : getKlass(t)) {
addExtends(k);
}
}
}
// parse attributes
annotationParser.parseAttributes(classfile.attributes);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
private void parseFields(boolean publicAPIs) throws IOException {
ConstantPool cpool = classfile.constant_pool;
for (Field f : classfile.fields) {
try {
AccessFlags flags = f.access_flags;
if (publicAPIs && !flags.is(ACC_PUBLIC) && !flags.is(ACC_PROTECTED)) {
continue;
}
String fieldname = f.getName(cpool);
Signature_attribute sigAttr = (Signature_attribute) f.attributes.get(Attribute.Signature);
if (sigAttr == null) {
Set<Klass> types = parseDescriptor(f.descriptor);
String info = getFlag(flags) + " " + f.descriptor.getFieldType(cpool) + " " + fieldname;
addFieldTypes(types, info, flags);
} else {
Type t = sigAttr.getParsedSignature().getType(cpool);
String info = getFlag(flags) + " " + t + " " + fieldname;
addFieldTypes(getKlass(t), info, flags);
}
// parse attributes
annotationParser.parseAttributes(f.attributes);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
} catch (InvalidDescriptor ex) {
throw new RuntimeException(ex);
}
}
}
private void parseMethods(boolean publicAPIs) {
for (Method m : classfile.methods) {
if (publicAPIs && !m.access_flags.is(ACC_PUBLIC) && !m.access_flags.is(ACC_PROTECTED)) {
// only interest in the API level
return;
}
parseMethod(m);
}
}
String checkClassName(String classname) {
int i = 0;
while (i < classname.length()) {
switch (classname.charAt(i)) {
case 'Z':
case 'B':
case 'C':
case 'S':
case 'I':
case 'J':
case 'F':
case 'D':
return "";
case 'L':
if (!classname.endsWith(";")) {
throw new RuntimeException("Invalid classname " + classname);
}
return classname.substring(i + 1, classname.length() - 1);
case '[':
i++;
break;
default:
if (classname.endsWith(";")) {
throw new RuntimeException("Invalid classname " + classname);
}
return classname;
}
}
throw new RuntimeException("Invalid classname " + classname);
}
private void addExtends(String classname) throws IOException {
if (!buildDeps) {
return;
}
addExtends(Klass.getKlass(classname));
}
private void addExtends(Klass k) {
if (!buildDeps) {
return;
}
ResolutionInfo resInfo = ResolutionInfo.resolvedExtends(this_klass, k);
resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC));
this_klass.addDep(k, resInfo);
k.addReferrer(this_klass, resInfo);
}
private void addImplements(String classname) throws IOException {
if (!buildDeps) {
return;
}
addImplements(Klass.getKlass(classname));
}
private void addImplements(Klass k) {
if (!buildDeps) {
return;
}
ResolutionInfo resInfo = ResolutionInfo.resolvedImplements(this_klass, k);
resInfo.setPublicAccess(classfile.access_flags.is(ACC_PUBLIC));
this_klass.addDep(k, resInfo);
k.addReferrer(this_klass, resInfo);
}
private Set<Klass> getKlass(Type type) throws IOException {
Set<Klass> refTypes = new TreeSet<Klass>();
if (!buildDeps) {
return refTypes;
}
type.accept(typevisitor, refTypes);
return refTypes;
}
private Type.Visitor<Void, Set<Klass>> typevisitor = new Type.Visitor<Void, Set<Klass>>() {
public Void visitSimpleType(SimpleType type, Set<Klass> klasses) {
// nop
return null;
}
public Void visitArrayType(ArrayType type, Set<Klass> klasses) {
try {
klasses.addAll(getKlass(type.elemType));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return null;
}
public Void visitMethodType(MethodType type, Set<Klass> klasses) {
throw new InternalError("Unexpected type " + type);
}
public Void visitClassSigType(ClassSigType type, Set<Klass> klasses) {
try {
if (type.superclassType != null) {
klasses.addAll(getKlass(type.superclassType));
}
if (type.superinterfaceTypes != null) {
for (Type t : type.superinterfaceTypes) {
klasses.addAll(getKlass(t));
}
}
if (type.typeParamTypes != null) {
for (Type t : type.typeParamTypes) {
klasses.addAll(getKlass(t));
}
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return null;
}
public Void visitClassType(ClassType type, Set<Klass> klasses) {
klasses.add(Klass.getKlass(type.getBinaryName()));
if (type.typeArgs != null) {
for (Type t : type.typeArgs) {
try {
klasses.addAll(getKlass(t));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
return null;
}
public Void visitTypeParamType(TypeParamType type, Set<Klass> klasses) {
try {
if (type.classBound != null) {
klasses.addAll(getKlass(type.classBound));
}
if (type.interfaceBounds != null) {
for (Type t : type.interfaceBounds) {
klasses.addAll(getKlass(t));
}
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return null;
}
public Void visitWildcardType(WildcardType type, Set<Klass> klasses) {
if (type.boundType != null) {
try {
klasses.addAll(getKlass(type.boundType));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
return null;
}
};
private void printMethod(Method m) {
try {
System.out.println("parsing " + m.getName(classfile.constant_pool) + "(" +
m.descriptor.getParameterTypes(classfile.constant_pool) + ") return type " +
m.descriptor.getReturnType(classfile.constant_pool));
} catch (ConstantPoolException ex) {
} catch (InvalidDescriptor ex) {
}
}
private static StringBuilder appendWord(StringBuilder sb, String word) {
if (sb.length() > 0) {
sb.append(" ");
}
sb.append(word);
return sb;
}
private static String getFlag(AccessFlags flags) {
StringBuilder modifier = new StringBuilder();
if (flags.is(ACC_PUBLIC)) {
modifier.append("public");
}
if (flags.is(ACC_PRIVATE)) {
modifier.append("private");
}
if (flags.is(ACC_PROTECTED)) {
modifier.append("protected");
}
if (flags.is(ACC_STATIC)) {
appendWord(modifier, "static");
}
if (flags.is(ACC_FINAL)) {
appendWord(modifier, "final");
}
if (flags.is(ACC_SYNCHRONIZED)) {
// return "synchronized";
}
if (flags.is(0x80)) {
// return (t == Type.Field ? "transient" : null);
// return "transient";
}
if (flags.is(ACC_VOLATILE)) {
// return "volatile";
}
if (flags.is(ACC_NATIVE)) {
// return "native";
}
if (flags.is(ACC_ABSTRACT)) {
appendWord(modifier, "abstract");
}
if (flags.is(ACC_STRICT)) {
// return "strictfp";
}
if (flags.is(ACC_MODULE)) {
appendWord(modifier, "module");
}
return modifier.toString();
}
private Klass.Method toKlassMethod(Method m, Descriptor d) {
try {
ConstantPool cpool = classfile.constant_pool;
String methodname = m.getName(cpool);
StringBuilder sb = new StringBuilder();
sb.append(getFlag(m.access_flags));
if (methodname.equals("<init>")) {
String s = this_klass.getBasename() + d.getParameterTypes(cpool);
appendWord(sb, s);
} else if (methodname.equals("<clinit>")) {
// <clinit>
appendWord(sb, methodname);
} else {
String s = d.getReturnType(cpool) + " " + methodname + d.getParameterTypes(cpool);
appendWord(sb, s);
}
String signature = sb.toString().replace('/', '.');
return this_klass.getMethod(methodname, signature);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
} catch (InvalidDescriptor ex) {
throw new RuntimeException(ex);
}
}
Klass.Method parseMethod(Method m) {
AccessFlags flags = m.access_flags;
Descriptor d;
List<? extends Type> methodExceptions = null;
try {
ConstantPool cpool = classfile.constant_pool;
Klass.Method kmethod;
Signature_attribute sigAttr = (Signature_attribute) m.attributes.get(Attribute.Signature);
if (sigAttr == null) {
d = m.descriptor;
Set<Klass> types = parseDescriptor(d);
kmethod = toKlassMethod(m, d);
addMethodTypes(types, kmethod, flags);
} else {
Type.MethodType methodType;
Signature methodSig = sigAttr.getParsedSignature();
d = methodSig;
try {
kmethod = toKlassMethod(m, d);
methodType = (Type.MethodType) methodSig.getType(cpool);
addMethodTypes(getKlass(methodType.returnType), kmethod, flags);
if (methodType.paramTypes != null) {
for (Type t : methodType.paramTypes) {
addMethodTypes(getKlass(t), kmethod, flags);
}
}
if (methodType.typeParamTypes != null) {
for (Type t : methodType.typeParamTypes) {
addMethodTypes(getKlass(t), kmethod, flags);
}
}
methodExceptions = methodType.throwsTypes;
if (methodExceptions != null) {
if (methodExceptions.size() == 0) {
methodExceptions = null;
} else {
for (Type t : methodExceptions) {
addCheckedExceptionTypes(getKlass(t), kmethod, flags);
}
}
}
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
Attribute e_attr = m.attributes.get(Attribute.Exceptions);
if (e_attr != null && methodExceptions == null) {
// if there are generic exceptions, there must be erased exceptions
if (e_attr instanceof Exceptions_attribute) {
Exceptions_attribute exceptions = (Exceptions_attribute) e_attr;
for (int i = 0; i < exceptions.number_of_exceptions; i++) {
String classname = checkClassName(exceptions.getException(i, classfile.constant_pool));
if (classname.length() > 0 && buildDeps) {
Klass to = Klass.getKlass(classname);
ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, kmethod);
resInfo.setPublicAccess(flags.is(ACC_PUBLIC));
this_klass.addDep(to, resInfo);
to.addReferrer(this_klass, resInfo);
}
}
} else {
throw new RuntimeException("Invalid attribute: " + e_attr);
}
}
Code_attribute c_attr = (Code_attribute) m.attributes.get(Attribute.Code);
if (c_attr != null) {
codeAttributeParser.parse(c_attr, kmethod);
}
kmethod.isAbstract = classfile.access_flags.is(ACC_ABSTRACT);
kmethod.setCodeLength(m.byteLength());
// parse annotation attributes
annotationParser.parseAttributes(m.attributes, kmethod);
return kmethod;
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
private void addFieldTypes(Set<Klass> types, String info, AccessFlags flags) {
if (types.isEmpty() || !buildDeps) {
return;
}
for (Klass to : types) {
ResolutionInfo resInfo = ResolutionInfo.resolvedField(this_klass, to, info);
resInfo.setPublicAccess(flags.is(ACC_PUBLIC));
this_klass.addDep(to, resInfo);
to.addReferrer(this_klass, resInfo);
}
}
private void addReferencedTypes(Method m, Descriptor d, AccessFlags flags) {
Set<Klass> types = parseDescriptor(d);
Klass.Method method = toKlassMethod(m, d);
addMethodTypes(types, method, flags);
}
private void addMethodTypes(Set<Klass> types, Klass.Method method, AccessFlags flags) {
if (types.isEmpty() || !buildDeps) {
return;
}
for (Klass to : types) {
ResolutionInfo resInfo = ResolutionInfo.resolvedMethodSignature(this_klass, to, method);
resInfo.setPublicAccess(flags.is(ACC_PUBLIC));
this_klass.addDep(to, resInfo);
to.addReferrer(this_klass, resInfo);
}
}
private void addCheckedExceptionTypes(Set<Klass> types, Klass.Method method, AccessFlags flags) {
if (types.isEmpty() || !buildDeps) {
return;
}
for (Klass to : types) {
ResolutionInfo resInfo = ResolutionInfo.resolvedCheckedException(this_klass, to, method);
resInfo.setPublicAccess(flags.is(ACC_PUBLIC));
this_klass.addDep(to, resInfo);
to.addReferrer(this_klass, resInfo);
}
}
private Set<Klass> parseDescriptor(Descriptor d) {
Set<Klass> types = new TreeSet<Klass>();
try {
String desc = d.getValue(classfile.constant_pool);
int p = 0;
while (p < desc.length()) {
String type;
char ch;
switch (ch = desc.charAt(p++)) {
case '(':
case ')':
case '[':
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':
case 'V':
continue;
case 'L':
int sep = desc.indexOf(';', p);
if (sep == -1) {
throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc);
}
type = checkClassName(desc.substring(p, sep));
p = sep + 1;
break;
default:
throw new RuntimeException("Invalid descriptor: " + (p - 1) + " " + desc);
}
if (!type.isEmpty() && buildDeps) {
Klass to = Klass.getKlass(type);
types.add(to);
}
}
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
return types;
}
}

View File

@ -1,275 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
*
* @author mchung
*/
public class ClassPath {
public class FileInfo {
File file;
JarFile jarfile;
int classCount;
long filesize;
FileInfo(File f) throws IOException {
this.file = f;
this.classCount = 0;
if (file.getName().endsWith(".jar")) {
this.filesize = file.length();
jarfile = new JarFile(f);
}
}
File getFile() {
return file;
}
JarFile getJarFile() {
return jarfile;
}
String getName() throws IOException {
return file.getCanonicalPath();
}
}
private List<FileInfo> fileList = new ArrayList<FileInfo>();
private static ClassPath instance = new ClassPath();
static List<FileInfo> getFileInfos() {
return instance.fileList;
}
static ClassPath setJDKHome(String jdkhome) throws IOException {
List<File> files = new ArrayList<File>();
File jre = new File(jdkhome, "jre");
File lib = new File(jdkhome, "lib");
if (jre.exists() && jre.isDirectory()) {
listFiles(new File(jre, "lib"), ".jar", files);
} else if (lib.exists() && lib.isDirectory()) {
// either a JRE or a jdk build image
listFiles(lib, ".jar", files);
File classes = new File(jdkhome, "classes");
if (classes.exists() && classes.isDirectory()) {
// jdk build outputdir
instance.add(classes);
}
} else {
throw new RuntimeException("\"" + jdkhome + "\" not a JDK home");
}
for (File f : files) {
instance.add(f);
}
return instance;
}
static ClassPath setClassPath(String path) throws IOException {
if (path.endsWith(".class")) {
// one class file
File f = new File(path);
if (!f.exists()) {
throw new RuntimeException("Classfile \"" + f + "\" doesn't exist");
}
instance.add(f);
} else {
List<File> jarFiles = new ArrayList<File>();
String[] locs = path.split(File.pathSeparator);
for (String p : locs) {
File f = new File(p);
if (!f.exists()) {
throw new RuntimeException("\"" + f + "\" doesn't exist");
}
if (f.isDirectory()) {
instance.add(f); // add the directory to look up .class files
listFiles(f, ".jar", jarFiles);
} else if (p.endsWith(".jar")) {
// jar files
jarFiles.add(f);
} else {
throw new RuntimeException("Invalid file \"" + f);
}
}
// add jarFiles if any
for (File f : jarFiles) {
instance.add(f);
}
}
return instance;
}
private void add(File f) throws IOException {
fileList.add(new FileInfo(f));
}
public static InputStream open(String pathname) throws IOException {
for (FileInfo fi : instance.fileList) {
if (fi.getName().endsWith(".jar")) {
String path = pathname.replace(File.separatorChar, '/');
JarEntry e = fi.jarfile.getJarEntry(path);
if (e != null) {
return fi.jarfile.getInputStream(e);
}
} else if (fi.getFile().isDirectory()) {
File f = new File(fi.getFile(), pathname);
if (f.exists()) {
return new FileInputStream(f);
}
} else if (fi.file.isFile()) {
if (fi.getName().endsWith(File.separator + pathname)) {
return new FileInputStream(fi.file);
}
}
}
return null;
}
static ClassFileParser parserForClass(String classname) throws IOException {
String pathname = classname.replace('.', File.separatorChar) + ".class";
ClassFileParser cfparser = null;
for (FileInfo fi : instance.fileList) {
if (fi.getName().endsWith(".class")) {
if (fi.getName().endsWith(File.separator + pathname)) {
cfparser = ClassFileParser.newParser(fi.getFile(), true);
break;
}
} else if (fi.getName().endsWith(".jar")) {
JarEntry e = fi.jarfile.getJarEntry(classname.replace('.', '/') + ".class");
if (e != null) {
cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true);
break;
}
} else if (fi.getFile().isDirectory()) {
File f = new File(fi.getFile(), pathname);
if (f.exists()) {
cfparser = ClassFileParser.newParser(f, true);
break;
}
}
}
return cfparser;
}
public static void parseAllClassFiles() throws IOException {
instance.parseFiles();
}
private void parseFiles() throws IOException {
Set<Klass> classes = new HashSet<Klass>();
int count = 0;
for (FileInfo fi : fileList) {
// filter out public generated classes (i.e. not public API)
// javax.management.remote.rmi._RMIConnectionImpl_Tie
// javax.management.remote.rmi._RMIServerImpl_Tie
if (fi.getName().endsWith(".class")) {
parseClass(fi);
} else if (fi.getName().endsWith(".jar")) {
Enumeration<JarEntry> entries = fi.jarfile.entries();
while (entries.hasMoreElements()) {
JarEntry e = entries.nextElement();
if (e.getName().endsWith(".class")) {
ClassFileParser cfparser = ClassFileParser.newParser(fi.jarfile.getInputStream(e), e.getSize(), true);
cfparser.parseDependency(false);
fi.classCount++;
} else if (!e.isDirectory() && ResourceFile.isResource(e.getName())) {
ResourceFile.addResource(e.getName(), fi.jarfile.getInputStream(e));
}
}
} else if (fi.getFile().isDirectory()) {
List<File> files = new ArrayList<File>();
listFiles(fi.getFile(), "", files);
for (File f : files) {
if (f.getName().endsWith(".class")) {
parseClass(fi, f);
} else if (!f.isDirectory() && ResourceFile.isResource(f.getCanonicalPath())) {
String pathname = f.getCanonicalPath();
String dir = fi.getName();
if (!pathname.startsWith(dir)) {
throw new RuntimeException("Incorrect pathname " + pathname);
}
String name = pathname.substring(dir.length() + 1, pathname.length());
BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
try {
ResourceFile.addResource(name, in);
} finally {
in.close();
}
}
}
} else {
// should not reach here
throw new RuntimeException("Unexpected class path: " + fi.getFile());
}
}
}
private void parseClass(FileInfo fi) throws IOException {
parseClass(fi, fi.getFile());
}
private void parseClass(FileInfo fi, File f) throws IOException {
ClassFileParser cfparser = ClassFileParser.newParser(f, true);
cfparser.parseDependency(false);
fi.classCount++;
// need to update the filesize for this directory
fi.filesize += fi.getFile().length();
}
public static void listFiles(File path, String suffix, List<File> result) {
if (path.isDirectory()) {
File[] children = path.listFiles();
for (File c : children) {
listFiles(c, suffix, result);
}
} else {
if (suffix.isEmpty() || path.getName().endsWith(suffix)) {
result.add(path);
}
}
}
}

View File

@ -1,157 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.classanalyzer.Klass.Method;
import com.sun.tools.classfile.*;
import com.sun.tools.classfile.Instruction.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
*
* @author Mandy Chung
*/
public class CodeAttributeParser {
private final ClassFileParser cfparser;
private final ConstantPool cpool;
private final ConstantPoolParser constantPoolParser;
static final Map<String, Set<Method>> runtimeReferences =
new HashMap<String, Set<Method>>();
CodeAttributeParser(ClassFileParser parser) {
this.cfparser = parser;
this.cpool = cfparser.classfile.constant_pool;
this.constantPoolParser = cfparser.constantPoolParser;
}
static boolean parseCodeAttribute = false; // by default don't parse code attribute
static void setParseCodeAttribute(boolean newValue) {
parseCodeAttribute = newValue;
}
void parse(Code_attribute attr, Klass.Method method) {
if (!parseCodeAttribute) {
return;
}
for (Instruction instr : attr.getInstructions()) {
try {
instr.accept(instructionVisitor, method);
} catch (ArrayIndexOutOfBoundsException e) {
throw new RuntimeException("error at or after byte " + instr.getPC());
}
}
if (attr.exception_table_langth > 0) {
for (int i = 0; i <
attr.exception_table.length; i++) {
Code_attribute.Exception_data handler = attr.exception_table[i];
int catch_type = handler.catch_type;
if (catch_type > 0) {
addMethodReference(catch_type, method);
}
}
}
}
private void addMethodReference(int index, Klass.Method m) {
String method = constantPoolParser.getMethodName(index);
if (method != null &&
(method.equals("java.lang.Class.forName") ||
method.equals("java.lang.Class.loadClass") ||
method.startsWith("java.util.ServiceLoader.load") ||
method.equals("sun.misc.Service.providers"))) {
Set<Method> refs = runtimeReferences.get(method);
if (refs == null) {
refs = new TreeSet<Method>();
runtimeReferences.put(method, refs);
}
refs.add(m);
}
}
Instruction.KindVisitor<Void, Klass.Method> instructionVisitor =
new Instruction.KindVisitor<Void, Klass.Method>() {
public Void visitNoOperands(Instruction instr, Klass.Method m) {
return null;
}
public Void visitArrayType(Instruction instr, TypeKind kind, Klass.Method m) {
return null;
}
public Void visitBranch(Instruction instr, int offset, Klass.Method m) {
return null;
}
public Void visitConstantPoolRef(Instruction instr, int index, Klass.Method m) {
addMethodReference(index, m);
return null;
}
public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Klass.Method m) {
addMethodReference(index, m);
return null;
}
public Void visitLocal(Instruction instr, int index, Klass.Method m) {
return null;
}
public Void visitLocalAndValue(Instruction instr, int index, int value, Klass.Method m) {
return null;
}
public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Klass.Method m) {
return null;
}
public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Klass.Method m) {
return null;
}
public Void visitValue(Instruction instr, int value, Klass.Method m) {
return null;
}
public Void visitUnknown(Instruction instr, Klass.Method m) {
return null;
}
};
}

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
/**
*
* @author Mandy Chung
*/
public class ConstantPoolAnalyzer {
public static void main(String[] args) throws Exception {
String jdkhome = null;
// process arguments
int i = 0;
while (i < args.length) {
String arg = args[i++];
if (arg.equals("-jdkhome")) {
if (i < args.length) {
jdkhome = args[i++];
} else {
usage();
}
}
}
if (jdkhome == null) {
usage();
}
ClassPath.setJDKHome(jdkhome);
ClassPath.parseAllClassFiles();
}
private static void usage() {
System.out.println("Usage: ConstantPoolAnalyzer <options>");
System.out.println("Options: ");
System.out.println("\t-jdkhome <JDK home> where all jars will be parsed");
System.out.println("\t-cpath <classpath> where classes and jars will be parsed");
System.exit(-1);
}
}

View File

@ -1,377 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.tools.classfile.*;
import com.sun.tools.classfile.ConstantPool.*;
import static com.sun.tools.classfile.ConstantPool.*;
/**
*
* @author Mandy Chung
*/
public class ConstantPoolParser {
private final ClassFileParser cfparser;
private final StringValueVisitor visitor;
private final ConstantPool cpool;
ConstantPoolParser(ClassFileParser parser) {
this.cfparser = parser;
this.cpool = cfparser.classfile.constant_pool;
this.visitor = new StringValueVisitor();
}
public String stringValue(CPInfo cpInfo) {
return visitor.visit(cpInfo);
}
public String stringValue(int constant_pool_index) {
try {
return stringValue(cpool.get(constant_pool_index));
} catch (ConstantPool.InvalidIndex e) {
throw new RuntimeException(e);
}
}
public void parseDependency() {
ConstantPool.Visitor<Integer, Void> v = new ConstantPool.Visitor<Integer, Void>() {
public Integer visitClass(CONSTANT_Class_info info, Void p) {
try {
String classname = cfparser.checkClassName(info.getName());
if (classname.isEmpty()) {
return 1;
}
Klass from = cfparser.this_klass;
Klass to = Klass.getKlass(classname);
ResolutionInfo resInfo = ResolutionInfo.resolvedConstantPool(from, to, info.name_index);
from.addDep(to, resInfo);
to.addReferrer(from, resInfo);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
return 1;
}
public Integer visitDouble(CONSTANT_Double_info info, Void p) {
// skip
return 2;
}
public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) {
// skip
return 1;
}
public Integer visitFloat(CONSTANT_Float_info info, Void p) {
// skip
return 1;
}
public Integer visitInteger(CONSTANT_Integer_info info, Void p) {
// skip
return 1;
}
public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
// skip
return 1;
}
public Integer visitLong(CONSTANT_Long_info info, Void p) {
// skip
return 2;
}
public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
// skip
return 1;
}
public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) {
// skip
return 1;
}
public Integer visitString(CONSTANT_String_info info, Void p) {
// skip
return 1;
}
public Integer visitUtf8(CONSTANT_Utf8_info info, Void p) {
// skip
return 1;
}
};
int cpx = 1;
while (cpx < cpool.size()) {
try {
CPInfo cpInfo = cpool.get(cpx);
cpx += cpInfo.accept(v, null);
} catch (ConstantPool.InvalidIndex ex) {
throw new RuntimeException(ex);
}
}
}
int getTag(int index) {
try {
return cpool.get(index).getTag();
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
String getDescriptor(int index) {
CPInfo cpInfo;
try {
cpInfo = cpool.get(index);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
int tag = cpInfo.getTag();
switch (tag) {
case CONSTANT_Methodref:
case CONSTANT_InterfaceMethodref:
case CONSTANT_Fieldref:
// simplify references within this class
CPRefInfo ref = (CPRefInfo) cpInfo;
try {
return ref.getNameAndTypeInfo().getType();
} catch (ConstantPoolException ex) {
}
}
return stringValue(cpInfo);
}
String getMethodName(int index) {
try {
CPInfo cpInfo = cpool.get(index);
if (cpInfo.getTag() == CONSTANT_Methodref ||
cpInfo.getTag() == CONSTANT_InterfaceMethodref) {
// simplify references within this class
CPRefInfo ref = (CPRefInfo) cpInfo;
String classname;
if (ref.class_index == cfparser.classfile.this_class) {
classname = cfparser.this_klass.getClassName();
} else {
classname = cfparser.checkClassName(ref.getClassName()).replace('/', '.');
}
String methodname = ref.getNameAndTypeInfo().getName();
return classname + "." + methodname;
} else {
return null;
}
} catch (InvalidIndex ex) {
throw new RuntimeException(ex);
} catch (ConstantPoolException ex) {
throw new RuntimeException(ex);
}
}
class StringValueVisitor implements ConstantPool.Visitor<String, Void> {
public StringValueVisitor() {
}
public String visit(CPInfo info) {
return info.accept(this, null);
}
public String visitClass(CONSTANT_Class_info info, Void p) {
return getCheckedName(info);
}
String getCheckedName(CONSTANT_Class_info info) {
try {
return checkName(info.getName());
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
public String visitDouble(CONSTANT_Double_info info, Void p) {
return info.value + "d";
}
public String visitFieldref(CONSTANT_Fieldref_info info, Void p) {
return visitRef(info, p);
}
public String visitFloat(CONSTANT_Float_info info, Void p) {
return info.value + "f";
}
public String visitInteger(CONSTANT_Integer_info info, Void p) {
return String.valueOf(info.value);
}
public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
return visitRef(info, p);
}
public String visitLong(CONSTANT_Long_info info, Void p) {
return info.value + "l";
}
public String visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
return getCheckedName(info) + ":" + getType(info);
}
String getCheckedName(CONSTANT_NameAndType_info info) {
try {
return checkName(info.getName());
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
String getType(CONSTANT_NameAndType_info info) {
try {
return info.getType();
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
public String visitMethodref(CONSTANT_Methodref_info info, Void p) {
return visitRef(info, p);
}
public String visitString(CONSTANT_String_info info, Void p) {
try {
int string_index = info.string_index;
return cpool.getUTF8Info(string_index).accept(this, p);
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
public String visitUtf8(CONSTANT_Utf8_info info, Void p) {
String s = info.value;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\t':
sb.append('\\').append('t');
break;
case '\n':
sb.append('\\').append('n');
break;
case '\r':
sb.append('\\').append('r');
break;
case '\"':
sb.append('\\').append('\"');
break;
default:
sb.append(c);
}
}
return sb.toString();
}
String visitRef(CPRefInfo info, Void p) {
String cn = getCheckedClassName(info);
String nat;
try {
nat = info.getNameAndTypeInfo().accept(this, p);
} catch (ConstantPoolException e) {
nat = e.getMessage();
}
return cn + "." + nat;
}
String getCheckedClassName(CPRefInfo info) {
try {
return checkName(info.getClassName());
} catch (ConstantPoolException e) {
throw new RuntimeException(e);
}
}
}
/* If name is a valid binary name, return it; otherwise quote it. */
private static String checkName(String name) {
if (name == null) {
return "null";
}
int len = name.length();
if (len == 0) {
return "\"\"";
}
int cc = '/';
int cp;
for (int k = 0; k < len; k += Character.charCount(cp)) {
cp = name.codePointAt(k);
if ((cc == '/' && !Character.isJavaIdentifierStart(cp)) || (cp != '/' && !Character.isJavaIdentifierPart(cp))) {
return "\"" + name + "\"";
}
cc = cp;
}
return name;
}
String tagName(int index) {
try {
int tag = cpool.get(index).getTag();
switch (tag) {
case CONSTANT_Utf8:
return "Utf8";
case CONSTANT_Integer:
return "int";
case CONSTANT_Float:
return "float";
case CONSTANT_Long:
return "long";
case CONSTANT_Double:
return "double";
case CONSTANT_Class:
return "class";
case CONSTANT_String:
return "String";
case CONSTANT_Fieldref:
return "Field";
case CONSTANT_Methodref:
return "Method";
case CONSTANT_InterfaceMethodref:
return "InterfaceMethod";
case CONSTANT_NameAndType:
return "NameAndType";
default:
return "(unknown tag)";
}
} catch (InvalidIndex e) {
throw new RuntimeException(e);
}
}
}

View File

@ -1,99 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
/**
* Config file specifying additional dependency
* Each line consists of:
* <tag> <classname> -> <value>
* where <tag> can be:
* @ClassForName and <value> is its dependency
* @Provider and <value> is the service name
* @Providers and <value> is the list of the service names
*
* @author Mandy Chung
*/
public class DependencyConfig {
private DependencyConfig() {
}
static void parse(List<String> configs) throws IOException {
for (String s : configs) {
parse(s);
}
}
private static void parse(String config) throws IOException {
// parse configuration file
FileInputStream in = new FileInputStream(config);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
int lineNumber = 0;
String type = null;
while ((line = reader.readLine()) != null) {
lineNumber++;
line = line.trim();
if (line.length() == 0 || line.charAt(0) == '#') {
continue;
}
if (line.charAt(0) == '@') {
if (AnnotatedDependency.isValidType(line)) {
type = line;
continue;
} else {
throw new RuntimeException(config + ", line " +
lineNumber + ", invalid annotation type.");
}
}
String[] s = line.split("\\s+");
if (s.length < 3 || !s[1].equals("->")) {
throw new RuntimeException(config + ", line " +
lineNumber + ", is malformed");
}
String classname = s[0].trim();
String value = s[2].trim();
Klass k = Klass.findKlass(classname);
if (k == null) {
// System.out.println("Warning: " + classname + " cannot be found");
continue;
}
AnnotatedDependency dep = AnnotatedDependency.newAnnotatedDependency(type, value, k);
if (dep == null) {
throw new RuntimeException(config + ", line " +
lineNumber + ", is malformed. Fail to construct the dependency.");
}
}
} finally {
in.close();
}
}
}

View File

@ -1,357 +0,0 @@
/*
* Copyright (c) 2009, 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.
*
* 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 com.sun.classanalyzer;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
import com.sun.tools.classfile.AccessFlags;
/**
*
* @author Mandy Chung
*/
public class Klass implements Comparable<Klass> {
private final String classname;
private final String packagename;
private Module module;
private boolean isJavaLangObject;
private String[] paths;
private Map<String, Set<Method>> methods;
private AccessFlags accessFlags;
private long filesize;
private SortedMap<Klass, Set<ResolutionInfo>> deps;
private SortedMap<Klass, Set<ResolutionInfo>> referrers;
private List<AnnotatedDependency> annotatedDeps;
private Set<String> classForNameRefs;
private Klass(String classname) {
this.classname = classname;
this.paths = classname.replace('.', '/').split("/");
this.isJavaLangObject = classname.equals("java.lang.Object");
this.deps = new TreeMap<Klass, Set<ResolutionInfo>>();
this.referrers = new TreeMap<Klass, Set<ResolutionInfo>>();
this.methods = new HashMap<String, Set<Method>>();
this.annotatedDeps = new ArrayList<AnnotatedDependency>();
this.classForNameRefs = new TreeSet<String>();
int pos = classname.lastIndexOf('.');
this.packagename = (pos > 0) ? classname.substring(0, pos) : "<unnamed>";
}
String getBasename() {
return paths[paths.length - 1];
}
String getClassName() {
return classname;
}
String getPackageName() {
return packagename;
}
String getClassFilePathname() {
StringBuilder sb = new StringBuilder(paths[0]);
for (int i = 1; i < paths.length; i++) {
String p = paths[i];
sb.append(File.separator).append(p);
}
return sb.append(".class").toString();
}
boolean isPublic() {
return accessFlags == null || accessFlags.is(AccessFlags.ACC_PUBLIC);
}
Module getModule() {
return module;
}
void setModule(Module m) {
if (module != null) {
throw new RuntimeException("Module for " + this + " already set");
}
this.module = m;
}
Set<Klass> getReferencedClasses() {
return deps.keySet();
}
Set<Klass> getReferencingClasses() {
return referrers.keySet();
}
void setAccessFlags(int flags) {
this.accessFlags = new AccessFlags(flags);
}
void setFileSize(long size) {
this.filesize = size;
}
long getFileSize() {
return this.filesize;
}
boolean exists() {
return filesize > 0;
}
boolean skip(Klass k) {
// skip if either class is a root or same class
return k.isJavaLangObject || this == k || k.classname.equals(classname);
}
void addDep(Method callee, ResolutionInfo resInfo) {
addDep(callee.getKlass(), resInfo);
}
void addDep(Klass ref, ResolutionInfo ri) {
if (skip(ref)) {
return;
}
Set<ResolutionInfo> resInfos;
if (!deps.containsKey(ref)) {
resInfos = new TreeSet<ResolutionInfo>();
deps.put(ref, resInfos);
} else {
resInfos = deps.get(ref);
}
resInfos.add(ri);
}
void addReferrer(Method caller, ResolutionInfo resInfo) {
addReferrer(caller.getKlass(), resInfo);
}
void addReferrer(Klass k, ResolutionInfo ri) {
if (skip(k)) {
return;
}
Set<ResolutionInfo> resInfos;
if (!referrers.containsKey(k)) {
resInfos = new TreeSet<ResolutionInfo>();
referrers.put(k, resInfos);
} else {
resInfos = referrers.get(k);
}
resInfos.add(ri);
}
Method getMethod(String name) {
return getMethod(name, "");
}
Method getMethod(String name, String signature) {
Set<Method> set;
if (methods.containsKey(name)) {
set = methods.get(name);
} else {
set = new TreeSet<Method>();
methods.put(name, set);
}
for (Method m : set) {
if (m.getName().equals(name) && m.getSignature().equals(signature)) {
return m;
}
}
Method m = new Method(this, name, signature);
set.add(m);
return m;
}
@Override
public String toString() {
return classname;
}
@Override
public int compareTo(Klass o) {
return classname.compareTo(o.classname);
}
void addAnnotatedDep(AnnotatedDependency dep) {
annotatedDeps.add(dep);
}
void addClassForNameReference(String method) {
classForNameRefs.add(method);
}
List<AnnotatedDependency> getAnnotatedDeps() {
return annotatedDeps;
}
private static Map<String, Klass> classes = new TreeMap<String, Klass>();
static Set<Klass> getAllClasses() {
return new TreeSet<Klass>(classes.values());
}
static Klass findKlassFromPathname(String filename) {
String name = filename;
if (filename.endsWith(".class")) {
name = filename.substring(0, filename.length() - 6);
}
// trim ".class"
name = name.replace('/', '.');
for (Klass k : classes.values()) {
if (name.endsWith(k.getClassName())) {
return k;
}
}
return null;
}
static Klass findKlass(String classname) {
return classes.get(classname);
}
static Klass getKlass(String name) {
Klass k;
String classname = name.replace('/', '.');
if (classname.charAt(classname.length() - 1) == ';') {
classname = classname.substring(0, classname.length() - 1);
}
if (classes.containsKey(classname)) {
k = classes.get(classname);
} else {
k = new Klass(classname);
classes.put(classname, k);
}
return k;
}
public class Method implements Comparable<Method> {
private final Klass k;
private final String method;
private final String signature;
private long codeLength;
// non-primitive types only
private final List<Klass> argTypes;
private final Klass returnType;
boolean isAbstract = false;
boolean marked = false;
public Method(Klass k, String method, String signature) {
this(k, method, signature, null, null);
}
public Method(Klass k, String method, String signature, Klass returnType, List<Klass> argTypes) {
this.k = k;
this.method = method;
this.signature = signature;
this.argTypes = argTypes;
this.returnType = returnType;
this.codeLength = 0;
}
public Klass getKlass() {
return k;
}
public String getName() {
return method;
}
public String getSignature() {
return signature;
}
public Klass getReturnType() {
return returnType;
}
public List<Klass> argTypes() {
return argTypes;
}
public void setCodeLength(long len) {
this.codeLength = len;
}
public long getCodeLength() {
return codeLength;
}
@Override
public boolean equals(Object o) {
if (o instanceof Method) {
return compareTo((Method) o) == 0;
} else {
return false;
}
}
@Override
public int hashCode() {
int hash = 3;
hash = 71 * hash + (this.k != null ? this.k.hashCode() : 0);
hash = 71 * hash + (this.method != null ? this.method.hashCode() : 0);
return hash;
}
@Override
public String toString() {
if (signature.isEmpty()) {
return k.classname + "." + method;
} else {
return signature;
}
}
public String toHtmlString() {
return toString().replace("<", "&lt;").replace(">", "&gt;");
}
boolean isClinit() {
return method.equals("<clinit>");
}
public int compareTo(Method m) {
if (k == m.getKlass()) {
if (method.equals(m.method)) {
return signature.compareTo(m.signature);
} else {
return method.compareTo(m.method);
}
} else {
return k.compareTo(m.getKlass());
}
}
}
}

View File

@ -1,693 +0,0 @@
/*
* Copyright (c) 2009, 2010, 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.
*
* 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 com.sun.classanalyzer;
import com.sun.classanalyzer.AnnotatedDependency.OptionalDependency;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
/**
*
* @author Mandy Chung
*/
public class Module implements Comparable<Module> {
private static Map<String, Module> modules = new LinkedHashMap<String, Module>();
public static Module addModule(ModuleConfig config) {
String name = config.module;
if (modules.containsKey(name)) {
throw new RuntimeException("module \"" + name + "\" already exists");
}
Module m = new Module(config);
modules.put(name, m);
return m;
}
public static Module findModule(String name) {
return modules.get(name);
}
static Collection<Module> getAllModules() {
return Collections.unmodifiableCollection(modules.values());
}
private final String name;
private final ModuleConfig config;
private final Set<Klass> classes;
private final Set<ResourceFile> resources;
private final Set<Reference> unresolved;
private final Set<Dependency> dependents;
private final Map<String, PackageInfo> packages;
private final Set<Module> members;
private Module group;
private boolean isBaseModule;
private Module(ModuleConfig config) {
this.name = config.module;
this.isBaseModule = config.isBase;
this.classes = new TreeSet<Klass>();
this.resources = new TreeSet<ResourceFile>();
this.config = config;
this.unresolved = new HashSet<Reference>();
this.dependents = new TreeSet<Dependency>();
this.packages = new TreeMap<String, PackageInfo>();
this.members = new TreeSet<Module>();
this.group = this; // initialize to itself
}
String name() {
return name;
}
Module group() {
return group;
}
boolean isBase() {
return isBaseModule;
}
Set<Module> members() {
return members;
}
boolean contains(Klass k) {
return k != null && classes.contains(k);
}
boolean isEmpty() {
return classes.isEmpty() && resources.isEmpty();
}
/**
* Returns an Iterable of Dependency, only one for each dependent
* module of the strongest dependency (i.e.
* hard static > hard dynamic > optional static > optional dynamic
*/
Iterable<Dependency> dependents() {
Map<Module, Dependency> deps = new LinkedHashMap<Module, Dependency>();
for (Dependency dep : dependents) {
Dependency d = deps.get(dep.module);
if (d == null || dep.compareTo(d) > 0) {
deps.put(dep.module, dep);
}
}
return deps.values();
}
@Override
public int compareTo(Module o) {
if (o == null) {
return -1;
}
return name.compareTo(o.name);
}
@Override
public String toString() {
return name;
}
void addKlass(Klass k) {
classes.add(k);
k.setModule(this);
// update package statistics
String pkg = k.getPackageName();
PackageInfo pkginfo = packages.get(pkg);
if (pkginfo == null) {
pkginfo = new PackageInfo(pkg);
packages.put(pkg, pkginfo);
}
if (k.exists()) {
// only count the class that is parsed
pkginfo.add(k.getFileSize());
}
}
void addResource(ResourceFile res) {
resources.add(res);
res.setModule(this);
}
void processRootsAndReferences() {
// start with the root set
Deque<Klass> pending = new ArrayDeque<Klass>();
for (Klass k : Klass.getAllClasses()) {
if (k.getModule() != null) {
continue;
}
String classname = k.getClassName();
if (config.matchesRoot(classname) && !config.isExcluded(classname)) {
addKlass(k);
pending.add(k);
}
}
// follow all references
Klass k;
while ((k = pending.poll()) != null) {
if (!classes.contains(k)) {
addKlass(k);
}
for (Klass other : k.getReferencedClasses()) {
Module otherModule = other.getModule();
if (otherModule != null && otherModule != this) {
// this module is dependent on otherModule
addDependency(k, other);
continue;
}
if (!classes.contains(other)) {
if (config.isExcluded(other.getClassName())) {
// reference to an excluded class
unresolved.add(new Reference(k, other));
} else {
pending.add(other);
}
}
}
}
// add other matching classes that don't require dependency analysis
for (Klass c : Klass.getAllClasses()) {
if (c.getModule() == null) {
String classname = c.getClassName();
if (config.matchesIncludes(classname) && !config.isExcluded(classname)) {
addKlass(c);
// dependencies
for (Klass other : c.getReferencedClasses()) {
Module otherModule = other.getModule();
if (otherModule == null) {
unresolved.add(new Reference(c, other));
} else {
if (otherModule != this) {
// this module is dependent on otherModule
addDependency(c, other);
}
}
}
}
}
}
// add other matching classes that don't require dependency analysis
for (ResourceFile res : ResourceFile.getAllResources()) {
if (res.getModule() == null) {
String name = res.getName();
if (config.matchesIncludes(name) && !config.isExcluded(name)) {
addResource(res);
}
}
}
}
void addDependency(Klass from, Klass to) {
Dependency dep = new Dependency(from, to);
dependents.add(dep);
}
void fixupDependencies() {
// update dependencies for classes that were allocated to modules after
// this module was processed.
for (Reference ref : unresolved) {
Module m = ref.referree().getModule();
if (m == null || m != this) {
addDependency(ref.referrer, ref.referree);
}
}
fixupAnnotatedDependencies();
}
private void fixupAnnotatedDependencies() {
// add dependencies that this klass may depend on due to the AnnotatedDependency
dependents.addAll(AnnotatedDependency.getDependencies(this));
}
boolean isModuleDependence(Klass k) {
Module m = k.getModule();
return m == null || (!classes.contains(k) && !m.isBase());
}
Module getModuleDependence(Klass k) {
if (isModuleDependence(k)) {
Module m = k.getModule();
if (group == this && m != null) {
// top-level module
return m.group;
} else {
return m;
}
}
return null;
}
<P> void visit(Set<Module> visited, Visitor<P> visitor, P p) {
if (!visited.contains(this)) {
visited.add(this);
visitor.preVisit(this, p);
for (Module m : members) {
m.visit(visited, visitor, p);
visitor.postVisit(this, m, p);
}
} else {
throw new RuntimeException("Cycle detected: module " + this.name);
}
}
void addMember(Module m) {
// merge class list
for (Klass k : m.classes) {
classes.add(k);
}
// merge resource list
for (ResourceFile res : m.resources) {
resources.add(res);
}
// merge the package statistics
for (PackageInfo pinfo : m.getPackageInfos()) {
String packageName = pinfo.pkgName;
PackageInfo pkginfo = packages.get(packageName);
if (pkginfo == null) {
pkginfo = new PackageInfo(packageName);
packages.put(packageName, pkginfo);
}
pkginfo.add(pinfo);
}
}
static void buildModuleMembers() {
// set up module member relationship
for (Module m : modules.values()) {
m.group = m; // initialize to itself
for (String name : m.config.members()) {
Module member = modules.get(name);
if (member == null) {
throw new RuntimeException("module \"" + name + "\" doesn't exist");
}
m.members.add(member);
}
}
// set up the top-level module
Visitor<Module> groupSetter = new Visitor<Module>() {
public void preVisit(Module m, Module p) {
m.group = p;
if (p.isBaseModule) {
// all members are also base
m.isBaseModule = true;
}
}
public void postVisit(Module m, Module child, Module p) {
// nop - breadth-first search
}
};
// propagate the top-level module to all its members
for (Module p : modules.values()) {
for (Module m : p.members) {
if (m.group == m) {
m.visit(new TreeSet<Module>(), groupSetter, p);
}
}
}
Visitor<Module> mergeClassList = new Visitor<Module>() {
public void preVisit(Module m, Module p) {
// nop - depth-first search
}
public void postVisit(Module m, Module child, Module p) {
m.addMember(child);
}
};
Set<Module> visited = new TreeSet<Module>();
for (Module m : modules.values()) {
if (m.group() == m) {
if (m.members().size() > 0) {
// merge class list from all its members
m.visit(visited, mergeClassList, m);
}
// clear the dependencies before fixup
m.dependents.clear();
// fixup dependencies
for (Klass k : m.classes) {
for (Klass other : k.getReferencedClasses()) {
if (m.isModuleDependence(other)) {
// this module is dependent on otherModule
m.addDependency(k, other);
}
}
}
// add dependencies that this klass may depend on due to the AnnotatedDependency
m.fixupAnnotatedDependencies();
}
}
}
class PackageInfo implements Comparable {
final String pkgName;
int count;
long filesize;
PackageInfo(String name) {
this.pkgName = name;
this.count = 0;
this.filesize = 0;
}
void add(PackageInfo pkg) {
this.count += pkg.count;
this.filesize += pkg.filesize;
}
void add(long size) {
count++;
filesize += size;
}
@Override
public int compareTo(Object o) {
return pkgName.compareTo(((PackageInfo) o).pkgName);
}
}
Set<PackageInfo> getPackageInfos() {
return new TreeSet<PackageInfo>(packages.values());
}
void printSummaryTo(String output) throws IOException {
PrintWriter writer = new PrintWriter(output);
try {
long total = 0L;
int count = 0;
writer.format("%10s\t%10s\t%s\n", "Bytes", "Classes", "Package name");
for (String pkg : packages.keySet()) {
PackageInfo info = packages.get(pkg);
if (info.count > 0) {
writer.format("%10d\t%10d\t%s\n", info.filesize, info.count, pkg);
total += info.filesize;
count += info.count;
}
}
writer.format("\nTotal: %d bytes (uncompressed) %d classes\n", total, count);
} finally {
writer.close();
}
}
void printClassListTo(String output) throws IOException {
// no file created if the module doesn't have any class nor resource
if (isEmpty()) {
return;
}
PrintWriter writer = new PrintWriter(output);
try {
for (Klass c : classes) {
if (c.exists()) {
writer.format("%s\n", c.getClassFilePathname());
} else {
trace("%s in module %s missing\n", c, this);
}
}
} finally {
writer.close();
}
}
void printResourceListTo(String output) throws IOException {
// no file created if the module doesn't have any resource file
if (resources.isEmpty()) {
return;
}
PrintWriter writer = new PrintWriter(output);
try {
for (ResourceFile res : resources) {
writer.format("%s\n", res.getPathname());
}
} finally {
writer.close();
}
}
void printDependenciesTo(String output, boolean showDynamic) throws IOException {
// no file created if the module doesn't have any class
if (isEmpty()) {
return;
}
PrintWriter writer = new PrintWriter(output);
try {
// classes that this klass may depend on due to the AnnotatedDependency
Map<Reference, Set<AnnotatedDependency>> annotatedDeps = AnnotatedDependency.getReferences(this);
for (Klass klass : classes) {
Set<Klass> references = klass.getReferencedClasses();
for (Klass other : references) {
String classname = klass.getClassName();
boolean optional = OptionalDependency.isOptional(klass, other);
if (optional) {
classname = "[optional] " + classname;
}
Module m = getModuleDependence(other);
if (m != null || other.getModule() == null) {
writer.format("%-40s -> %s (%s)", classname, other, m);
Reference ref = new Reference(klass, other);
if (annotatedDeps.containsKey(ref)) {
for (AnnotatedDependency ad : annotatedDeps.get(ref)) {
writer.format(" %s", ad.getTag());
}
// printed; so remove the dependency from the annotated deps list
annotatedDeps.remove(ref);
}
writer.format("\n");
}
}
}
// print remaining dependencies specified in AnnotatedDependency list
if (annotatedDeps.size() > 0) {
for (Map.Entry<Reference, Set<AnnotatedDependency>> entry : annotatedDeps.entrySet()) {
Reference ref = entry.getKey();
Module m = getModuleDependence(ref.referree);
if (m != null || ref.referree.getModule() == null) {
String classname = ref.referrer.getClassName();
boolean optional = true;
boolean dynamic = true;
String tag = "";
for (AnnotatedDependency ad : entry.getValue()) {
if (optional && !ad.isOptional()) {
optional = false;
tag = ad.getTag();
}
if (!ad.isDynamic()) {
dynamic = false;
}
}
if (!showDynamic && optional && dynamic) {
continue;
}
if (optional) {
if (dynamic) {
classname = "[dynamic] " + classname;
} else {
classname = "[optional] " + classname;
}
}
writer.format("%-40s -> %s (%s) %s%n", classname, ref.referree, m, tag);
}
}
}
} finally {
writer.close();
}
}
static class Dependency implements Comparable<Dependency> {
final Module module;
final boolean optional;
final boolean dynamic;
Dependency(Klass from, Klass to) {
// static dependency
this.module = to.getModule() != null ? to.getModule().group() : null;
this.optional = OptionalDependency.isOptional(from, to);
this.dynamic = false;
}
Dependency(Module m, boolean optional, boolean dynamic) {
this.module = m != null ? m.group() : null;
this.optional = optional;
this.dynamic = dynamic;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Dependency)) {
return false;
}
if (this == obj) {
return true;
}
Dependency d = (Dependency) obj;
if (this.module != d.module) {
return false;
} else {
return this.optional == d.optional && this.dynamic == d.dynamic;
}
}
@Override
public int hashCode() {
int hash = 3;
hash = 19 * hash + (this.module != null ? this.module.hashCode() : 0);
hash = 19 * hash + (this.optional ? 1 : 0);
hash = 19 * hash + (this.dynamic ? 1 : 0);
return hash;
}
@Override
public int compareTo(Dependency d) {
if (this.equals(d)) {
return 0;
}
// Hard static > hard dynamic > optional static > optional dynamic
if (this.module == d.module) {
if (this.optional == d.optional) {
return this.dynamic ? -1 : 1;
} else {
return this.optional ? -1 : 1;
}
} else if (this.module != null && d.module != null) {
return (this.module.compareTo(d.module));
} else {
return (this.module == null) ? -1 : 1;
}
}
@Override
public String toString() {
String s = module.name();
if (dynamic && optional) {
s += " (dynamic)";
} else if (optional) {
s += " (optional)";
}
return s;
}
}
static class Reference implements Comparable<Reference> {
private final Klass referrer, referree;
Reference(Klass referrer, Klass referree) {
this.referrer = referrer;
this.referree = referree;
}
Klass referrer() {
return referrer;
}
Klass referree() {
return referree;
}
@Override
public int hashCode() {
return referrer.hashCode() ^ referree.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Reference)) {
return false;
}
if (this == obj) {
return true;
}
Reference r = (Reference) obj;
return (this.referrer.equals(r.referrer) &&
this.referree.equals(r.referree));
}
@Override
public int compareTo(Reference r) {
int ret = referrer.compareTo(r.referrer);
if (ret == 0) {
ret = referree.compareTo(r.referree);
}
return ret;
}
}
interface Visitor<P> {
public void preVisit(Module m, P param);
public void postVisit(Module m, Module child, P param);
}
private static boolean traceOn = System.getProperty("classanalyzer.debug") != null;
private static void trace(String format, Object... params) {
System.err.format(format, params);
}
}

Some files were not shown because too many files have changed in this diff Show More