Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade OpenJDK to jdk8u101-b13 #265

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion IKVM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tools.Importer.Tests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tests.Java", "src\IKVM.Tests.Java\IKVM.Tests.Java.msbuildproj", "{87CB99AE-16D1-4D58-BEAC-72485E02B321}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IKVM.ByteCode.Tests", "src\IKVM.ByteCode.Tests\IKVM.ByteCode.Tests.csproj", "{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.ByteCode.Tests", "src\IKVM.ByteCode.Tests\IKVM.ByteCode.Tests.csproj", "{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "schemagen", "src\schemagen\schemagen.msbuildproj", "{BA2907A2-45DA-4567-9158-FB57D805D90D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -601,6 +603,10 @@ Global
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.Build.0 = Release|Any CPU
{BA2907A2-45DA-4567-9158-FB57D805D90D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA2907A2-45DA-4567-9158-FB57D805D90D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA2907A2-45DA-4567-9158-FB57D805D90D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA2907A2-45DA-4567-9158-FB57D805D90D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion openjdk
6,291 changes: 11 additions & 6,280 deletions openjdk.props

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/IKVM.Image.JDK-bin/IKVM.Image.JDK-bin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<BinProject Include="..\jdeps\jdeps.msbuildproj" />
<BinProject Include="..\native2ascii\native2ascii.msbuildproj" />
<BinProject Include="..\rmic\rmic.msbuildproj" />
<BinProject Include="..\schemagen\schemagen.msbuildproj" />
<BinProject Include="..\wsgen\wsgen.msbuildproj" />
<BinProject Include="..\wsimport\wsimport.msbuildproj" />
</ItemGroup>
Expand Down
72 changes: 44 additions & 28 deletions src/IKVM.Java/local/java/security/ProtectionDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,44 @@
*/

public class ProtectionDomain {
private static class JavaSecurityAccessImpl implements JavaSecurityAccess {

static {
// Set up JavaSecurityAccess in SharedSecrets
SharedSecrets.setJavaSecurityAccess(
new JavaSecurityAccess() {
public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
final AccessControlContext stack,
final AccessControlContext context)
{
if (action == null) {
throw new NullPointerException();
}
return AccessController.doPrivileged(
action,
new AccessControlContext(
stack.getContext(), context).optimize()
);
}
private JavaSecurityAccessImpl() {
}

public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
AccessControlContext context)
{
return doIntersectionPrivilege(action,
AccessController.getContext(), context);
}
@Override
public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
final AccessControlContext stack,
final AccessControlContext context) {
if (action == null) {
throw new NullPointerException();
}
);

return AccessController.doPrivileged(
action,
getCombinedACC(context, stack)
);
}

@Override
public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
AccessControlContext context) {
return doIntersectionPrivilege(action,
AccessController.getContext(), context);
}

private static AccessControlContext getCombinedACC(AccessControlContext context, AccessControlContext stack) {
AccessControlContext acc = new AccessControlContext(context, stack.getCombiner(), true);

return new AccessControlContext(stack.getContext(), acc).optimize();
}
}

static {
// Set up JavaSecurityAccess in SharedSecrets
SharedSecrets.setJavaSecurityAccess(new JavaSecurityAccessImpl());
}

/* CodeSource */
Expand Down Expand Up @@ -117,6 +126,8 @@ or dynamic (via a policy refresh) */
*/
final Key key = new Key();

private static final Debug debug = Debug.getInstance("domain");

/* [IKVM] constructor for use by the runtime (AssemblyClassLoader) */
ProtectionDomain(cli.System.Reflection.Assembly assembly) {
this.assembly = assembly;
Expand Down Expand Up @@ -169,7 +180,6 @@ private void lazyInitCodeSource() {
}
}
}

/**
* Creates a new ProtectionDomain with the given CodeSource and
* Permissions. If the permissions object is not null, then
Expand Down Expand Up @@ -345,6 +355,7 @@ boolean impliesCreateAccessControlContext() {
@Override public String toString() {
lazyInitCodeSource();
lazyInitClassLoader();

String pals = "<no principals>";
if (principals != null && principals.length > 0) {
StringBuilder palBuf = new StringBuilder("(principals ");
Expand Down Expand Up @@ -395,7 +406,6 @@ private static boolean seeAllp() {
if (sm == null) {
return true;
} else {
Debug debug = Debug.getInstance("domain");
if (debug != null) {
if (sm.getClass().getClassLoader() == null &&
Policy.getPolicyNoCheck().getClass().getClassLoader()
Expand All @@ -417,6 +427,7 @@ private static boolean seeAllp() {

private PermissionCollection mergePermissions() {
lazyInitPermissions();

if (staticPermissions)
return permissions;

Expand Down Expand Up @@ -527,6 +538,11 @@ public PermissionCollection get(ProtectionDomain pd) {
}
};
}

@Override
public boolean getStaticPermissionsField(ProtectionDomain pd) {
return pd.staticPermissions;
}
});
}
}
67 changes: 42 additions & 25 deletions src/IKVM.Java/local/java/util/zip/ZipEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
class ZipEntry implements ZipConstants, Cloneable {

String name; // entry name
long time = -1; // last modification time
long xdostime = -1; // last modification time (in extended DOS time,
// where milliseconds lost in conversion might
// be encoded into the upper half)
FileTime mtime; // last modification time, from extra field data
FileTime atime; // last access time, from extra field data
FileTime ctime; // creation time, from extra field data
Expand All @@ -53,7 +55,6 @@ class ZipEntry implements ZipConstants, Cloneable {
byte[] extra; // optional extra field data for entry
String comment; // optional comment string for entry
long offset; // [IKVM] used by ZipFile
volatile long dostime = -1; // [IKVM] undecoded DOS time (to avoid bootstrap issue, because java.util.Date needs to read from VFS zip file)

/**
* Compression method for uncompressed entries.
Expand All @@ -65,6 +66,28 @@ class ZipEntry implements ZipConstants, Cloneable {
*/
public static final int DEFLATED = 8;

/**
* DOS time constant for representing timestamps before 1980.
*/
static final long DOSTIME_BEFORE_1980 = (1 << 21) | (1 << 16);

/**
* Approximately 128 years, in milliseconds (ignoring leap years etc).
*
* This establish an approximate high-bound value for DOS times in
* milliseconds since epoch, used to enable an efficient but
* sufficient bounds check to avoid generating extended last modified
* time entries.
*
* Calculating the exact number is locale dependent, would require loading
* TimeZone data eagerly, and would make little practical sense. Since DOS
* times theoretically go to 2107 - with compatibility not guaranteed
* after 2099 - setting this to a time that is before but near 2099
* should be sufficient.
*/
private static final long UPPER_DOSTIME_BOUND =
128L * 365 * 24 * 60 * 60 * 1000;

/**
* Creates a new zip entry with the specified name.
*
Expand Down Expand Up @@ -95,7 +118,7 @@ public ZipEntry(String name) {
public ZipEntry(ZipEntry e) {
Objects.requireNonNull(e, "entry");
name = e.name;
time = e.time;
xdostime = e.xdostime;
mtime = e.mtime;
atime = e.atime;
ctime = e.ctime;
Expand All @@ -106,7 +129,6 @@ public ZipEntry(ZipEntry e) {
flag = e.flag;
extra = e.extra;
comment = e.comment;
dostime = e.dostime;
}

/**
Expand Down Expand Up @@ -140,9 +162,14 @@ public String getName() {
* @see #getLastModifiedTime()
*/
public void setTime(long time) {
this.time = time;
this.dostime = -1;
this.mtime = null;
this.xdostime = javaToExtendedDosTime(time);
// Avoid setting the mtime field if time is in the valid
// range for a DOS time
if (xdostime != DOSTIME_BEFORE_1980 && time <= UPPER_DOSTIME_BOUND) {
this.mtime = null;
} else {
this.mtime = FileTime.from(time, TimeUnit.MILLISECONDS);
}
}

/**
Expand All @@ -162,16 +189,10 @@ public void setTime(long time) {
* @see #setLastModifiedTime(FileTime)
*/
public long getTime() {
return getTimeImpl();
}

// [IKVM] we store the DOS time to avoid a bootstrap issue
private long getTimeImpl() {
long tmp = dostime;
if (tmp != -1) {
return ZipUtils.dosToJavaTime(tmp);
if (mtime != null) {
return mtime.toMillis();
}
return time;
return (xdostime != -1) ? extendedDosToJavaTime(xdostime) : -1;
}

/**
Expand All @@ -193,10 +214,8 @@ private long getTimeImpl() {
* @since 1.8
*/
public ZipEntry setLastModifiedTime(FileTime time) {
Objects.requireNonNull(name, "time");
this.mtime = time;
this.time = time.to(TimeUnit.MILLISECONDS);
this.dostime = -1;
this.mtime = Objects.requireNonNull(time, "lastModifiedTime");
this.xdostime = javaToExtendedDosTime(time.to(TimeUnit.MILLISECONDS));
return this;
}

Expand All @@ -219,10 +238,9 @@ public ZipEntry setLastModifiedTime(FileTime time) {
public FileTime getLastModifiedTime() {
if (mtime != null)
return mtime;
long time = getTimeImpl();
if (time == -1)
if (xdostime == -1)
return null;
return FileTime.from(time, TimeUnit.MILLISECONDS);
return FileTime.from(getTime(), TimeUnit.MILLISECONDS);
}

/**
Expand All @@ -242,8 +260,7 @@ public FileTime getLastModifiedTime() {
* @since 1.8
*/
public ZipEntry setLastAccessTime(FileTime time) {
Objects.requireNonNull(name, "time");
this.atime = time;
this.atime = Objects.requireNonNull(time, "lastAccessTime");
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Java/local/java/util/zip/ZipFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void readEntries() throws IOException
ZipEntry entry = new ZipEntry();
entry.flag = flags;
entry.method = method;
entry.dostime = inp.readLeUnsignedInt();
entry.xdostime = inp.readLeUnsignedInt();
entry.crc = inp.readLeUnsignedInt();
entry.csize = inp.readLeUnsignedInt();
entry.size = inp.readLeUnsignedInt();
Expand Down
56 changes: 31 additions & 25 deletions src/IKVM.Java/local/sun/misc/OSEnvironment.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
/*
Copyright (C) 2007 Jeroen Frijters
* Copyright (c) 2005, 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.
*/

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
package sun.misc;

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
public class OSEnvironment {

Jeroen Frijters
jeroen@frijters.net

*/
/*
* Initialize any miscellenous operating system settings that need to be set
* for the class libraries.
*/
public static void initialize() {

package sun.misc;

public class OSEnvironment
{
public static void initialize()
{
}

}
Loading