author | chegar |
Wed, 03 Dec 2014 14:22:58 +0000 | |
changeset 27565 | 729f9700483a |
parent 17933 | b18cda672b79 |
permissions | -rw-r--r-- |
17933 | 1 |
#!/bin/sh |
2 | 2 |
# |
7668 | 3 |
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | 4 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 |
# |
|
6 |
# This code is free software; you can redistribute it and/or modify it |
|
7 |
# under the terms of the GNU General Public License version 2 only, as |
|
8 |
# published by the Free Software Foundation. |
|
9 |
# |
|
10 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
# accompanied this code). |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License version |
|
17 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
# |
|
5506 | 20 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 |
# or visit www.oracle.com if you need additional information or have any |
|
22 |
# questions. |
|
2 | 23 |
# |
24 |
||
25 |
# @test |
|
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
26 |
# @bug 6473331 6485027 6934615 |
2 | 27 |
# @summary Test handling of the Class-Path attribute in jar file manifests |
28 |
# for the rmic tool |
|
29 |
# @author Andrey Ozerov |
|
30 |
# |
|
31 |
# @run shell run.sh |
|
32 |
||
33 |
# To run this test manually, simply do ./run.sh |
|
34 |
||
35 |
. ${TESTSRC-.}/Util.sh |
|
36 |
||
37 |
set -u |
|
38 |
||
39 |
Cleanup() { |
|
40 |
Sys rm -rf pkg Main.java MainI.java Main.class MainI.class Main_Stub.class |
|
41 |
Sys rm -rf jars MANIFEST.MF A.jar B.zip |
|
42 |
} |
|
43 |
||
44 |
Cleanup |
|
45 |
Sys mkdir pkg |
|
46 |
||
47 |
#---------------------------------------------------------------- |
|
48 |
# Create mutually referential jar files |
|
49 |
#---------------------------------------------------------------- |
|
50 |
cat >pkg/A.java <<EOF |
|
51 |
package pkg; |
|
52 |
public class A implements java.io.Serializable { |
|
53 |
public int f(B b) { return b.g(); } |
|
54 |
public int g() { return 0; } |
|
55 |
} |
|
56 |
EOF |
|
57 |
||
58 |
cat >pkg/B.java <<EOF |
|
59 |
package pkg; |
|
60 |
public class B implements java.io.Serializable { |
|
61 |
public int f(A a) { return a.g(); } |
|
62 |
public int g() { return 0; } |
|
63 |
} |
|
64 |
EOF |
|
65 |
||
66 |
Sys "$javac" pkg/A.java pkg/B.java |
|
67 |
||
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
68 |
# NOTE: Previously, some lines were commented out and alternative lines |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
69 |
# provided, to work around javac bug 6485027. That bug, and related rmic |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
70 |
# bug 6934615 have now been fixed, so most of the workarounds have been |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
71 |
# removed. However, javac still does not evaluate jar class paths on |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
72 |
# the bootclasspath, including -extdirs. |
2 | 73 |
|
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
74 |
MkManifestWithClassPath "sub/B.zip" |
2 | 75 |
Sys "$jar" cmf MANIFEST.MF A.jar pkg/A.class |
76 |
||
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
77 |
MkManifestWithClassPath "../A.jar" |
2 | 78 |
Sys "$jar" cmf MANIFEST.MF B.zip pkg/B.class |
79 |
||
80 |
Sys rm -rf pkg |
|
81 |
Sys mkdir jars |
|
82 |
Sys mv A.jar jars/. |
|
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
83 |
Sys mkdir jars/sub |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
84 |
Sys mv B.zip jars/sub/. |
2 | 85 |
|
86 |
cat >MainI.java <<EOF |
|
87 |
import pkg.*; |
|
88 |
public interface MainI extends java.rmi.Remote { |
|
89 |
public int doIt(A a, B b) throws java.rmi.RemoteException; |
|
90 |
} |
|
91 |
EOF |
|
92 |
||
93 |
cat >Main.java <<EOF |
|
94 |
import pkg.*; |
|
95 |
import java.rmi.server.UnicastRemoteObject; |
|
96 |
public class Main implements MainI { |
|
97 |
public int doIt(A a, B b) { |
|
98 |
return a.f(b) + b.f(a); |
|
99 |
} |
|
100 |
public static void main(String args[]) throws Exception { |
|
101 |
Main impl = new Main(); |
|
102 |
try { |
|
103 |
MainI stub = (MainI) UnicastRemoteObject.exportObject(impl); |
|
104 |
int result = stub.doIt(new A(), new B()); |
|
105 |
System.exit(result); |
|
106 |
} finally { |
|
107 |
try { |
|
108 |
UnicastRemoteObject.unexportObject(impl, true); |
|
109 |
} catch (Exception e) { } |
|
110 |
} |
|
111 |
} |
|
112 |
} |
|
113 |
EOF |
|
114 |
||
115 |
Success "$javac" -classpath "jars/A.jar" Main.java MainI.java |
|
116 |
Success "$rmic" -classpath "jars/A.jar${PS}." Main |
|
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
7668
diff
changeset
|
117 |
Success "$java" ${TESTVMOPTS} -classpath "jars/A.jar${PS}." Main |
2 | 118 |
|
119 |
Sys rm -f Main.class MainI.class Main_Stub.class |
|
120 |
||
5623
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
121 |
Success "$javac" -classpath "jars/sub/B.zip" Main.java MainI.java |
5c9695dc013a
6934615: Relative classpaths in jarfile manifests are handled inefficiently by rmic
jjg
parents:
2
diff
changeset
|
122 |
Success "$rmic" -classpath "jars/sub/B.zip${PS}." Main |
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
7668
diff
changeset
|
123 |
Success "$java" ${TESTVMOPTS} -classpath "jars/sub/B.zip${PS}." Main |
2 | 124 |
|
125 |
Cleanup |
|
126 |
||
127 |
Bottom Line |