From a5c5bb811d1d01d32b3641170ea3db917454b5ab Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Fri, 4 Mar 2011 09:32:20 -0800 Subject: [PATCH 1/2] 7023963: (misc) fix diamond anon instances in the jdk Reviewed-by: alanb, mchung, mcimadamore, dholmes --- .../classes/com/sun/java/util/jar/pack/PackageReader.java | 4 ++-- .../classes/com/sun/java/util/jar/pack/PackageWriter.java | 4 ++-- .../nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java | 4 ++-- .../share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java index 41436e7b3b4..d676ee8e6fb 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, 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 @@ -1011,7 +1011,7 @@ class PackageReader extends BandStructure { return -1; } - Comparator entryOutputOrder = new Comparator<>() { + Comparator entryOutputOrder = new Comparator() { public int compare(Entry e0, Entry e1) { int k0 = getOutputIndex(e0); int k1 = getOutputIndex(e1); diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java index 8220e115663..f531fb7d999 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, 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 @@ -785,7 +785,7 @@ class PackageWriter extends BandStructure { defMap.entrySet().toArray(layoutsAndCounts); // Sort by count, most frequent first. // Predefs. participate in this sort, though it does not matter. - Arrays.sort(layoutsAndCounts, new Comparator<>() { + Arrays.sort(layoutsAndCounts, new Comparator() { public int compare(Object o0, Object o1) { Map.Entry e0 = (Map.Entry) o0; Map.Entry e1 = (Map.Entry) o1; diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java index 10f6bd477a9..543220fc63a 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipDirectoryStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -76,7 +76,7 @@ public class ZipDirectoryStream implements DirectoryStream { } catch (IOException e) { throw new IllegalStateException(e); } - return new Iterator<>() { + return new Iterator() { private Path next; @Override public boolean hasNext() { diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java index b03ba2929eb..1232a27ff1f 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -590,7 +590,7 @@ public class ZipPath implements Path { @Override public Iterator iterator() { - return new Iterator<>() { + return new Iterator() { private int i = 0; @Override From 2b73fac982c5f0ff14d5444c9fa57351c2a7a104 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Fri, 4 Mar 2011 11:35:53 -0800 Subject: [PATCH 2/2] 7023244: (zipfs) langtools CompileTest fails on read-only file system Replaced checkAccess with Files.isWritable() Reviewed-by: alanb --- .../demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java index 40afd8afb84..fc43fd87ccf 100644 --- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java @@ -112,11 +112,8 @@ public class ZipFileSystem extends FileSystem { } // sm and existence check zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.READ); - try { - zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.WRITE); - } catch (AccessDeniedException x) { + if (!Files.isWritable(zfpath)) this.readOnly = true; - } this.zc = ZipCoder.get(nameEncoding); this.defaultdir = new ZipPath(this, getBytes(defaultDir)); this.ch = Files.newByteChannel(zfpath, READ);