Fri, 12 Nov 2010 12:32:43 +0000
6598108: com.sun.source.util.Trees.isAccessible incorrect
Summary: JavacTrees' version of isAccessible should take into account enclosing class accessibility
Reviewed-by: jjg
1 #
2 # Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
26 #
27 # Makefile for building the langtools workspace.
28 #
30 #
31 # On Solaris, the standard 'make' utility will not work with these makefiles.
32 # This little rule is only understood by Solaris make, and is harmless
33 # when seen by the GNU make tool. If using Solaris make, this causes the
34 # make command to fail.
35 #
36 SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
38 #----- cancel implicit rules
40 %: %.o
41 %: %.obj
42 %: %.dll
43 %: %.c
44 %: %.cc
45 %: %.C
46 %: %.p
47 %: %.f
48 %: %.s
49 %: %.F
50 %: %.r
51 %: %.S
52 %: %.mod
53 %: %.sh
54 %: %,v
55 %: RCS/%,v
57 #----- imports
59 ifdef ALT_BOOT_JAVA_HOME
60 BOOT_JAVA_HOME = $(ALT_BOOT_JAVA_HOME)
61 else
62 ifdef ALT_BOOTDIR
63 BOOT_JAVA_HOME = $(ALT_BOOTDIR)
64 else
65 BOOT_JAVA_HOME=/java/re/jdk/1.5.0/archive/fcs/binaries/solaris-sparc
66 endif
67 endif
69 BOOT_JAVA=$(BOOT_JAVA_HOME)/bin/java
70 BOOT_JAVAC=$(BOOT_JAVA_HOME)/bin/javac
71 BOOTJAR=$(BOOT_JAVA_HOME)/bin/jar
73 ifdef ALT_TESTJAVA_HOME
74 TESTJAVA_HOME = $(ALT_TESTJAVA_HOME)
75 else
76 TESTJAVA_HOME=/java/re/jdk/1.6.0/archive/fcs/binaries/solaris-sparc
77 endif
79 TESTJAVA=$(TESTJAVA_HOME)/bin/java
81 ifdef ALT_FINDBUGS_HOME
82 FINDBUGS_HOME = $(ALT_FINDBUGS_HOME)
83 else
84 FINDBUGS_HOME = /java/devtools/share/findbugs/1.1.2-rc4
85 endif
87 FINDBUGS = $(FINDBUGS_HOME)/bin/findbugs
89 #----- commands
91 CHMOD = chmod
92 CP = cp
93 ECHO = echo # FIXME
94 FIND = find
95 MKDIR = mkdir
96 SED = sed
97 ZIP = zip
99 #----- locations and deliverables
101 TOPDIR = ..
102 SRC_BIN_DIR = $(TOPDIR)/src/share/bin
103 SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
105 BUILD_DIR = $(TOPDIR)/build
107 CLASSES_DIR = $(BUILD_DIR)/classes
108 GENSRC_DIR = $(BUILD_DIR)/gensrc
110 DIST_DIR = $(TOPDIR)/dist
111 BIN_DIR = $(DIST_DIR)/bin
112 LIB_DIR = $(DIST_DIR)/lib
114 JAVAC_JAR = $(LIB_DIR)/javac.jar
115 JAVADOC_JAR = $(LIB_DIR)/javadoc.jar
116 JAVAH_JAR = $(LIB_DIR)/javah.jar
117 JAVAP_JAR = $(LIB_DIR)/javap.jar
118 APT_JAR = $(LIB_DIR)/apt.jar
120 CLASSES_JAR = $(DIST_DIR)/classes.jar
121 SRC_ZIP = $(DIST_DIR)/src.zip
123 BUILDTOOLSRC_DIR = tools
124 BUILDTOOLCLASSES_DIR = $(BUILD_DIR)/toolclasses
126 #-----
128 ifndef JDK_MAJOR_VERSION
129 JDK_MAJOR_VERSION = 1
130 endif
132 ifndef JDK_MINOR_VERSION
133 JDK_MINOR_VERSION = 7
134 endif
136 ifndef JDK_MICRO_VERSION
137 JDK_MICRO_VERSION = 0
138 endif
140 ifndef JDK_VERSION
141 JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
142 endif
144 ifndef MILESTONE
145 MILESTONE = internal
146 endif
148 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
149 ifneq ($(MILESTONE),fcs)
150 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
151 else
152 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
153 endif
155 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
156 ifdef BUILD_NUMBER
157 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
158 else
159 BUILD_NUMBER = b00
160 USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
161 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
162 endif
164 #----- useful macros
166 TOOLS = javac javadoc javah javap apt
168 SOURCE_LEVEL = 5
169 BOOTSTRAP_TARGET_LEVEL = 5
170 TARGET_LEVEL = 6
172 ifndef TARGET_JAVA
173 TARGET_JAVA = java
174 endif
176 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
178 SELF = $(lastword $(MAKEFILE_LIST))
180 #-----
182 # the default is to generate the following:
183 # dist/{bin,lib}:
184 # lang tools compiled to run on the target JDK
186 default:
187 $(MAKE) -f $(SELF) \
188 MILESTONE=bootstrap \
189 TARGET_LEVEL=$(BOOTSTRAP_TARGET_LEVEL) \
190 TARGET_JAVA=$(BOOT_JAVA_HOME)/bin/java \
191 GENSRC_DIR=$(BUILD_DIR)/bootstrap/gensrc \
192 CLASSES_DIR=$(BUILD_DIR)/bootstrap/classes \
193 BIN_DIR=$(BUILD_DIR)/bootstrap/bin \
194 LIB_DIR=$(BUILD_DIR)/bootstrap/lib \
195 $(BUILD_DIR)/bootstrap/lib/javac.jar \
196 $(BUILD_DIR)/bootstrap/bin/javac
197 $(MAKE) -f $(SELF) \
198 BOOT_JAVAC=$(BUILD_DIR)/bootstrap/bin/javac \
199 tools
201 # for jdk, we generate the following:
202 # dist/bootstrap/{bin,lib}:
203 # lang tools compiled to run on the boot JDK
204 # dist/lib/classes.jar:
205 # lang tools recompiled to run on the target JDK,
206 # ready for inclusion in rt.jar and tools.jar
207 # dist/lib/src.zip
208 # .properties and .java files for classes in classes.jar,
209 # ready for jdk src.zip
211 jdk:
212 $(MAKE) -f $(SELF) \
213 MILESTONE=bootstrap \
214 TARGET_LEVEL=$(BOOTSTRAP_TARGET_LEVEL) \
215 TARGET_JAVA=$(BOOT_JAVA_HOME)/bin/java \
216 GENSRC_DIR=$(BUILD_DIR)/bootstrap/gensrc \
217 CLASSES_DIR=$(BUILD_DIR)/bootstrap/classes \
218 BIN_DIR=$(DIST_DIR)/bootstrap/bin \
219 LIB_DIR=$(DIST_DIR)/bootstrap/lib \
220 tools
221 $(MAKE) -f $(SELF) \
222 BOOT_JAVAC=$(DIST_DIR)/bootstrap/bin/javac \
223 LIB_DIR=$(BUILD_DIR)/jdk/lib \
224 $(DIST_DIR)/lib/classes.jar \
225 $(DIST_DIR)/lib/src.zip
227 tools: $(TOOLS:%=$(LIB_DIR)/%.jar) $(TOOLS:%=$(BIN_DIR)/%)
229 clean:
230 $(RM) -r $(BUILD_DIR)
232 really-clean: clean
233 $(RM) -r $(DIST_DIR)
235 jprt_product_build \
236 jprt_debug_build \
237 jprt_fastdebug_build: lib
239 #----- javac
241 JAVAC_DIRS = \
242 javax/annotation/processing \
243 javax/lang/model \
244 javax/tools \
245 com/sun/source \
246 com/sun/tools/javac
248 JAVAC_RESOURCE_FILES = \
249 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAC_DIRS)) -name SCCS -prune -o -name \*.properties -print )
251 JAVAC_JAVA_FILES = \
252 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAC_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
253 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAC_RESOURCE_FILES)) \
254 $(GENSRC_DIR)/com/sun/tools/javac/resources/version.java
256 $(JAVAC_JAR): $(JAVAC_JAVA_FILES)
257 $(MKDIR) -p $(CLASSES_DIR) $(@D)
258 $(BOOT_JAVAC) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(NO_PROPRIETARY_API_WARNINGS) $(JAVAC_JAVA_FILES)
259 ( $(ECHO) Main-Class: com.sun.tools.javac.Main ) > $(BUILD_DIR)/javac.mf
260 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javac.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAC_DIRS))
262 #----- javadoc
264 ### FIXME -- javadoc has a couple of extra non-property resource files
265 ### that need to be included
267 JAVADOC_DIRS = \
268 com/sun/javadoc \
269 com/sun/tools/doclets \
270 com/sun/tools/javadoc
272 JAVADOC_RESOURCE_FILES = \
273 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVADOC_DIRS)) -name SCCS -prune -o -name \*.properties -print )
275 JAVADOC_JAVA_FILES = \
276 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVADOC_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
277 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVADOC_RESOURCE_FILES))
279 $(JAVADOC_JAR): $(JAVADOC_JAVA_FILES) $(JAVAC_JAR)
280 $(MKDIR) -p $(CLASSES_DIR) $(@D)
281 $(BOOT_JAVAC) -sourcepath "" -classpath $(JAVAC_JAR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVADOC_JAVA_FILES)
282 ( $(ECHO) Main-Class: com.sun.tools.javadoc.Main ; $(ECHO) Class-Path: javac.jar ) > $(BUILD_DIR)/javadoc.mf
283 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javadoc.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVADOC_DIRS))
285 #----- javah
287 JAVAH_DIRS = \
288 com/sun/tools/javah
290 JAVAH_RESOURCE_FILES = \
291 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAH_DIRS)) -name SCCS -prune -o -name \*.properties -print )
293 JAVAH_JAVA_FILES = \
294 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAH_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
295 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAH_RESOURCE_FILES))
297 $(JAVAH_JAR): $(JAVAH_JAVA_FILES) $(JAVADOC_JAR)
298 $(MKDIR) -p $(CLASSES_DIR) $(@D)
299 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAH_JAVA_FILES)
300 ( $(ECHO) Main-Class: com.sun.tools.javah.Main ; $(ECHO) Class-Path: javadoc.jar ) > $(BUILD_DIR)/javah.mf
301 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javah.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAH_DIRS))
303 #----- javap
305 JAVAP_DIRS = \
306 sun/tools/javap
308 JAVAP_RESOURCE_FILES = \
309 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.properties -print )
311 JAVAP_JAVA_FILES = \
312 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
313 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
315 $(JAVAP_JAR): $(JAVAP_JAVA_FILES) \
316 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
317 $(MKDIR) -p $(CLASSES_DIR)
318 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAP_JAVA_FILES)
319 ( $(ECHO) Main-Class: sun.tools.javap.Main ) > $(BUILD_DIR)/javap.mf
320 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javap.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAP_DIRS))
322 #----- apt
324 APT_DIRS = \
325 com/sun/mirror \
326 com/sun/tools/apt
328 APT_RESOURCE_FILES = \
329 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.properties -print )
331 APT_JAVA_FILES = \
332 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
333 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
335 $(APT_JAR): $(APT_JAVA_FILES) $(JAVAC_JAR) \
336 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
337 $(MKDIR) -p $(CLASSES_DIR) $(@D)
338 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(NO_PROPRIETARY_API_WARNINGS) \
339 $(APT_JAVA_FILES) \
340 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
341 ( $(ECHO) Main-Class: com.sun.tools.apt.Main ; $(ECHO) Class-Path: javac.jar ) > $(BUILD_DIR)/apt.mf
342 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/apt.mf $(patsubst %,-C $(CLASSES_DIR) %, $(APT_DIRS))
344 #-----
346 build-tools: $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
348 $(GENSRC_DIR)/%.java: $(SRC_CLASSES_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
349 $(MKDIR) -p $(@D)
350 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
352 $(GENSRC_DIR)/%.java: $(GENSRC_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
353 $(MKDIR) -p $(@D)
354 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
356 $(GENSRC_DIR)/%.properties: $(SRC_CLASSES_DIR)/%.properties-template
357 $(MKDIR) -p $(@D)
358 $(SED) -e 's/$$(JDK_VERSION)/$(JDK_VERSION)/' \
359 -e 's/$$(FULL_VERSION)/$(FULL_VERSION)/' \
360 -e 's/$$(RELEASE)/$(RELEASE)/' \
361 < $< > $@
363 $(BUILDTOOLCLASSES_DIR)/%.class : $(BUILDTOOLSRC_DIR)/%.java
364 $(MKDIR) -p $(@D)
365 $(BOOT_JAVAC) -d $(@D) $<
367 #----- all classes
369 $(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR) $(APT_JAR)
370 $(MKDIR) -p $(@D)
371 $(BOOTJAR) -cf $@ -C $(CLASSES_DIR) .
373 #----- src.zip
375 SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name SCCS -o -name \*-template \) -prune -o -type f -print )
377 $(DIST_DIR)/%/src.zip: $(SRC_ZIP_FILES)
378 abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
379 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name SCCS -o -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
380 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . -name SCCS -prune -o -name \*-template -print | $(SED) -e 's/-template//' ) | ( cd $(GENSRC_DIR) ; $(ZIP) -q $$abs_src_zip -@ )
382 #----- bin files
384 $(BIN_DIR)/%: $(SRC_BIN_DIR)/launcher.sh-template
385 $(MKDIR) -p $(@D)
386 $(SED) -e 's|#PROGRAM#|$(@F)|' -e 's|#TARGET_JAVA#|$(TARGET_JAVA)|' $< > $@
387 $(CHMOD) +x $@
389 #-----
391 findbugs: $(BUILD_DIR)/findbugs.txt
393 $(BUILD_DIR)/findbugs.txt: $(CLASSES_JAR)
394 $(MKDIR) -p $(@D)
395 $(FINDBUGS) -textui -javahome $(BOOT_JAVA_HOME) -high -emacs -outputFile $@ $<
397 #-----
399 quick-check: $(patsubst %, $(DIST_LIB_DIR)/%.jar, $(TOOLS))
400 $(TESTJAVA) -jar $(JAVAC_JAR) -version
401 - $(TESTJAVA) -jar $(JAVADOC_JAR) -version
402 $(TESTJAVA) -jar $(JAVAH_JAR) -version
403 - $(TESTJAVA) -jar $(JAVAP_JAR) -version
404 $(TESTJAVA) -jar $(APT_JAR) -version
406 #-----
408 .PHONY: \
409 all \
410 build \
411 build-tools \
412 clean \
413 default \
414 findbugs \
415 jprt_product_build \
416 jprt_debug_build \
417 jprt_fastdebug_build \
418 tools