Merge
This commit is contained in:
commit
253948253b
@ -227,10 +227,12 @@ public class ModuleArchive implements Archive {
|
||||
|
||||
private static String nativeDir(String filename) {
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
if (filename.endsWith(".dll"))
|
||||
if (filename.endsWith(".dll") || filename.endsWith(".diz")
|
||||
|| filename.endsWith(".pdb") || filename.endsWith(".map")) {
|
||||
return "bin";
|
||||
else
|
||||
} else {
|
||||
return "lib";
|
||||
}
|
||||
} else {
|
||||
return "lib";
|
||||
}
|
||||
|
@ -758,8 +758,8 @@ class TzdbZoneRulesProvider {
|
||||
if (endYear == Year.MAX_VALUE) {
|
||||
endYear = startYear;
|
||||
lastRules.add(new TransRule(endYear, rule));
|
||||
lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
|
||||
}
|
||||
lastRulesStartYear = Math.max(startYear, lastRulesStartYear);
|
||||
} else {
|
||||
if (endYear == Year.MAX_VALUE) {
|
||||
//endYear = zoneEnd.getYear();
|
||||
|
@ -5,33 +5,53 @@ global.env.outputheight=480
|
||||
global.env.runcount=5
|
||||
global.env.repcount=0
|
||||
global.env.testtime=2500
|
||||
global.results.workunits=units
|
||||
global.results.timeunits=sec
|
||||
global.results.ratio=unitspersec
|
||||
global.dest.screen=disabled
|
||||
global.dest.offscreen=disabled
|
||||
global.dest.compatimg.compatimg=disabled
|
||||
global.dest.compatimg.opqcompatimg=disabled
|
||||
global.dest.compatimg.bmcompatimg=disabled
|
||||
global.dest.compatimg.transcompatimg=disabled
|
||||
global.dest.volimg=enabled
|
||||
global.dest.volimg.volimg=enabled
|
||||
global.dest.volimg.opqvolimg=disabled
|
||||
global.dest.volimg.bmvolimg=disabled
|
||||
global.dest.volimg.transvolimg=disabled
|
||||
global.dest.bufimg.IntXrgb=disabled
|
||||
global.dest.bufimg.IntArgb=disabled
|
||||
global.dest.bufimg.IntArgbPre=disabled
|
||||
global.dest.bufimg.3ByteBgr=disabled
|
||||
global.dest.bufimg.ByteIndexed=disabled
|
||||
global.dest.bufimg.ByteGray=disabled
|
||||
global.dest.bufimg.4ByteAbgr=disabled
|
||||
global.dest.bufimg.4ByteAbgrPre=disabled
|
||||
global.dest.bufimg.custom=disabled
|
||||
graphics.opts.anim=2
|
||||
graphics.opts.sizes=20,250
|
||||
graphics.opts.alpharule=SrcOver
|
||||
graphics.opts.transform=ident
|
||||
graphics.opts.extraalpha=Both
|
||||
graphics.opts.xormode=Off
|
||||
graphics.opts.clip=Both
|
||||
graphics.opts.renderhint=Default
|
||||
graphics.render.opts.randomcolor=Both
|
||||
graphics.render.opts.paint=single,random
|
||||
graphics.render.opts.alphacolor=Off
|
||||
graphics.render.opts.antialias=Both
|
||||
graphics.render.opts.stroke=width1
|
||||
graphics.render.tests.drawLine=enabled
|
||||
graphics.render.tests.drawLineHoriz=disabled
|
||||
graphics.render.tests.drawLineVert=disabled
|
||||
graphics.render.tests.fillRect=enabled
|
||||
graphics.render.tests.drawRect=disabled
|
||||
graphics.render.tests.fillOval=enabled
|
||||
graphics.render.tests.drawOval=disabled
|
||||
graphics.render.tests.fillPoly=disabled
|
||||
graphics.render.tests.drawPoly=disabled
|
||||
graphics.render.tests.shape.fillCubic=enabled
|
||||
graphics.render.tests.shape.drawCubic=disabled
|
||||
graphics.render.tests.shape.fillEllipse2D=disabled
|
||||
graphics.render.tests.shape.drawEllipse2D=disabled
|
||||
graphics.imaging.src.offscr.opaque=disabled
|
||||
graphics.imaging.src.offscr.bitmask=disabled
|
||||
graphics.imaging.src.offscr.translucent=disabled
|
||||
@ -44,33 +64,98 @@ graphics.imaging.src.bmcompatimg.translucent=disabled
|
||||
graphics.imaging.src.transcompatimg.opaque=disabled
|
||||
graphics.imaging.src.transcompatimg.bitmask=disabled
|
||||
graphics.imaging.src.transcompatimg.translucent=enabled
|
||||
graphics.imaging.src.volimg.opaque=disabled
|
||||
graphics.imaging.src.volimg.bitmask=disabled
|
||||
graphics.imaging.src.volimg.translucent=disabled
|
||||
graphics.imaging.src.opqvolimg.opaque=disabled
|
||||
graphics.imaging.src.opqvolimg.bitmask=disabled
|
||||
graphics.imaging.src.opqvolimg.translucent=disabled
|
||||
graphics.imaging.src.bmvolimg.opaque=disabled
|
||||
graphics.imaging.src.bmvolimg.bitmask=disabled
|
||||
graphics.imaging.src.bmvolimg.translucent=disabled
|
||||
graphics.imaging.src.transvolimg.opaque=disabled
|
||||
graphics.imaging.src.transvolimg.bitmask=disabled
|
||||
graphics.imaging.src.transvolimg.translucent=disabled
|
||||
graphics.imaging.src.bufimg.IntXrgb.opaque=enabled
|
||||
graphics.imaging.src.bufimg.IntXrgb.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.IntXrgb.translucent=disabled
|
||||
graphics.imaging.src.bufimg.IntArgb.opaque=disabled
|
||||
graphics.imaging.src.bufimg.IntArgb.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.IntArgb.translucent=enabled
|
||||
graphics.imaging.src.bufimg.IntArgbPre.opaque=disabled
|
||||
graphics.imaging.src.bufimg.IntArgbPre.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.IntArgbPre.translucent=disabled
|
||||
graphics.imaging.src.bufimg.ByteGray.opaque=disabled
|
||||
graphics.imaging.src.bufimg.ByteGray.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.ByteGray.translucent=disabled
|
||||
graphics.imaging.src.bufimg.3ByteBgr.opaque=disabled
|
||||
graphics.imaging.src.bufimg.3ByteBgr.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.3ByteBgr.translucent=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgr.opaque=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgr.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgr.translucent=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgrPre.opaque=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgrPre.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.4ByteAbgrPre.translucent=disabled
|
||||
graphics.imaging.src.bufimg.ByteIndexedBm.opaque=disabled
|
||||
graphics.imaging.src.bufimg.ByteIndexedBm.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.ByteIndexedBm.translucent=disabled
|
||||
graphics.imaging.tests.drawimage=enabled
|
||||
graphics.imaging.tests.drawimagebg=disabled
|
||||
graphics.imaging.tests.drawimagescaleup=enabled
|
||||
graphics.imaging.tests.drawimagescaledown=disabled
|
||||
graphics.imaging.tests.drawimagetxform=enabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntXrgb.opaque=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntXrgb.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntXrgb.translucent=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgb.opaque=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgb.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgb.translucent=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgbPre.opaque=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgbPre.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.unmanagedIntArgbPre.translucent=disabled
|
||||
graphics.imaging.src.bufimg.unmanaged3ByteBgr.opaque=disabled
|
||||
graphics.imaging.src.bufimg.unmanaged3ByteBgr.bitmask=disabled
|
||||
graphics.imaging.src.bufimg.unmanaged3ByteBgr.translucent=disabled
|
||||
graphics.imaging.benchmarks.opts.interpolation=Nearest neighbor
|
||||
graphics.imaging.benchmarks.opts.touchsrc=Off
|
||||
graphics.imaging.benchmarks.tests.drawimage=enabled
|
||||
graphics.imaging.benchmarks.tests.drawimagebg=disabled
|
||||
graphics.imaging.benchmarks.tests.drawimagescaleup=enabled
|
||||
graphics.imaging.benchmarks.tests.drawimagescaledown=disabled
|
||||
graphics.imaging.benchmarks.tests.drawimagescalesplit=disabled
|
||||
graphics.imaging.benchmarks.tests.drawimagetxform=enabled
|
||||
graphics.imaging.imageops.opts.op=convolve3x3zero
|
||||
graphics.imaging.imageops.tests.graphics2d.drawimageop=disabled
|
||||
graphics.imaging.imageops.tests.bufimgop.filternull=disabled
|
||||
graphics.imaging.imageops.tests.bufimgop.filtercached=disabled
|
||||
graphics.imaging.imageops.tests.rasterop.filternull=disabled
|
||||
graphics.imaging.imageops.tests.rasterop.filtercached=disabled
|
||||
graphics.misc.copytests.copyAreaVert=disabled
|
||||
graphics.misc.copytests.copyAreaHoriz=disabled
|
||||
graphics.misc.copytests.copyAreaDiag=disabled
|
||||
pixel.opts.renderto=Off
|
||||
pixel.opts.renderfrom=Off
|
||||
pixel.src.1BitBinary=disabled
|
||||
pixel.src.2BitBinary=disabled
|
||||
pixel.src.4BitBinary=disabled
|
||||
pixel.src.ByteIndexed=disabled
|
||||
pixel.src.ByteGray=disabled
|
||||
pixel.src.Short555=disabled
|
||||
pixel.src.Short565=disabled
|
||||
pixel.src.ShortGray=disabled
|
||||
pixel.src.3ByteBgr=disabled
|
||||
pixel.src.4ByteAbgr=disabled
|
||||
pixel.src.IntXrgb=disabled
|
||||
pixel.src.IntXbgr=disabled
|
||||
pixel.src.IntArgb=disabled
|
||||
pixel.bimgtests.getrgb=disabled
|
||||
pixel.bimgtests.setrgb=disabled
|
||||
pixel.rastests.getdataelem=disabled
|
||||
pixel.rastests.setdataelem=disabled
|
||||
pixel.rastests.getpixel=disabled
|
||||
pixel.rastests.setpixel=disabled
|
||||
pixel.dbtests.getelem=disabled
|
||||
pixel.dbtests.setelem=disabled
|
||||
text.opts.data.tlength=32
|
||||
text.opts.data.tscript=english
|
||||
text.opts.font.fname=lucida
|
||||
text.opts.font.fstyle=0
|
||||
text.opts.font.fsize=13.0
|
||||
text.opts.font.ftx=Identity
|
||||
text.opts.graphics.taa=Both
|
||||
text.opts.graphics.textaa=Off,On
|
||||
text.opts.graphics.tfm=Off
|
||||
text.opts.graphics.gaa=Off
|
||||
text.opts.graphics.gtx=Identity
|
||||
@ -114,3 +199,66 @@ text.construction.tests.gvfromfontglyphs=disabled
|
||||
text.construction.tests.gvfromfontlayout=disabled
|
||||
text.construction.tests.tlfromfont=disabled
|
||||
text.construction.tests.tlfrommap=disabled
|
||||
imageio.opts.size=250
|
||||
imageio.opts.content=photo
|
||||
imageio.input.opts.general.source.file=disabled
|
||||
imageio.input.opts.general.source.url=disabled
|
||||
imageio.input.opts.general.source.byteArray=disabled
|
||||
imageio.input.opts.imageio.useCache=Off
|
||||
imageio.input.image.toolkit.opts.format=
|
||||
imageio.input.image.toolkit.tests.createImage=disabled
|
||||
imageio.input.image.imageio.opts.format=
|
||||
imageio.input.image.imageio.tests.imageioRead=disabled
|
||||
imageio.input.image.imageio.reader.opts.seekForwardOnly=On
|
||||
imageio.input.image.imageio.reader.opts.ignoreMetadata=On
|
||||
imageio.input.image.imageio.reader.opts.installListener=Off
|
||||
imageio.input.image.imageio.reader.tests.read=disabled
|
||||
imageio.input.image.imageio.reader.tests.getImageMetadata=disabled
|
||||
imageio.input.stream.tests.construct=disabled
|
||||
imageio.input.stream.tests.read=disabled
|
||||
imageio.input.stream.tests.readByteArray=disabled
|
||||
imageio.input.stream.tests.readFullyByteArray=disabled
|
||||
imageio.input.stream.tests.readBit=disabled
|
||||
imageio.input.stream.tests.readByte=disabled
|
||||
imageio.input.stream.tests.readUnsignedByte=disabled
|
||||
imageio.input.stream.tests.readShort=disabled
|
||||
imageio.input.stream.tests.readUnsignedShort=disabled
|
||||
imageio.input.stream.tests.readInt=disabled
|
||||
imageio.input.stream.tests.readUnsignedInt=disabled
|
||||
imageio.input.stream.tests.readFloat=disabled
|
||||
imageio.input.stream.tests.readLong=disabled
|
||||
imageio.input.stream.tests.readDouble=disabled
|
||||
imageio.input.stream.tests.skipBytes=disabled
|
||||
imageio.output.opts.general.dest.file=disabled
|
||||
imageio.output.opts.general.dest.byteArray=disabled
|
||||
imageio.output.opts.imageio.useCache=Off
|
||||
imageio.output.image.imageio.opts.format=
|
||||
imageio.output.image.imageio.tests.imageioWrite=disabled
|
||||
imageio.output.image.imageio.writer.opts.installListener=Off
|
||||
imageio.output.image.imageio.writer.tests.write=disabled
|
||||
imageio.output.stream.tests.construct=disabled
|
||||
imageio.output.stream.tests.write=disabled
|
||||
imageio.output.stream.tests.writeByteArray=disabled
|
||||
imageio.output.stream.tests.writeBit=disabled
|
||||
imageio.output.stream.tests.writeByte=disabled
|
||||
imageio.output.stream.tests.writeShort=disabled
|
||||
imageio.output.stream.tests.writeInt=disabled
|
||||
imageio.output.stream.tests.writeFloat=disabled
|
||||
imageio.output.stream.tests.writeLong=disabled
|
||||
imageio.output.stream.tests.writeDouble=disabled
|
||||
cmm.opts.profiles=1001
|
||||
cmm.colorconv.data.fromRGB=disabled
|
||||
cmm.colorconv.data.toRGB=disabled
|
||||
cmm.colorconv.data.fromCIEXYZ=disabled
|
||||
cmm.colorconv.data.toCIEXYZ=disabled
|
||||
cmm.colorconv.ccop.ccopOptions.size=250
|
||||
cmm.colorconv.ccop.ccopOptions.content=photo
|
||||
cmm.colorconv.ccop.ccopOptions.srcType=INT_ARGB
|
||||
cmm.colorconv.ccop.ccopOptions.dstType=INT_ARGB
|
||||
cmm.colorconv.ccop.op_img=disabled
|
||||
cmm.colorconv.ccop.op_rst=disabled
|
||||
cmm.colorconv.ccop.op_draw=disabled
|
||||
cmm.colorconv.embed.embedOptions.Images=512x512
|
||||
cmm.colorconv.embed.embd_img_read=disabled
|
||||
cmm.profiles.getHeader=disabled
|
||||
cmm.profiles.getNumComponents=disabled
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, 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
|
||||
@ -57,6 +57,7 @@ public abstract class Destinations extends Option.Enable {
|
||||
public static Group.EnableSet destroot;
|
||||
public static Group bufimgdestroot;
|
||||
public static Group compatimgdestroot;
|
||||
public static Group volimgdestroot;
|
||||
|
||||
public static void init() {
|
||||
destroot = new Group.EnableSet(TestEnvironment.globaloptroot,
|
||||
@ -79,7 +80,16 @@ public abstract class Destinations extends Option.Enable {
|
||||
}
|
||||
|
||||
if (ImageTests.hasVolatileImage) {
|
||||
volimgdestroot = new Group.EnableSet(destroot, "volimg",
|
||||
"Output to Volatile Image");
|
||||
|
||||
volimgdestroot.setHorizontal();
|
||||
new VolatileImg();
|
||||
if (ImageTests.hasTransparentVolatileImage) {
|
||||
new VolatileImg(Transparency.OPAQUE);
|
||||
new VolatileImg(Transparency.BITMASK);
|
||||
new VolatileImg(Transparency.TRANSLUCENT);
|
||||
}
|
||||
}
|
||||
|
||||
bufimgdestroot = new Group.EnableSet(destroot, "bufimg",
|
||||
@ -91,6 +101,8 @@ public abstract class Destinations extends Option.Enable {
|
||||
new BufImg(BufferedImage.TYPE_3BYTE_BGR);
|
||||
new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
|
||||
new BufImg(BufferedImage.TYPE_BYTE_GRAY);
|
||||
new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
|
||||
new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE);
|
||||
new CustomImg();
|
||||
}
|
||||
}
|
||||
@ -206,18 +218,62 @@ public abstract class Destinations extends Option.Enable {
|
||||
}
|
||||
|
||||
public static class VolatileImg extends Destinations {
|
||||
private final int transparency;
|
||||
|
||||
public static final String[] ShortNames = {
|
||||
"volimg",
|
||||
"opqvolimg",
|
||||
"bmvolimg",
|
||||
"transvolimg",
|
||||
};
|
||||
|
||||
public static final String[] ShortDescriptions = {
|
||||
"Default",
|
||||
"Opaque",
|
||||
"Bitmask",
|
||||
"Translucent",
|
||||
};
|
||||
|
||||
public static final String[] LongDescriptions = {
|
||||
"Default VolatileImg Image",
|
||||
"Opaque VolatileImg Image",
|
||||
"Bitmask VolatileImg Image",
|
||||
"Translucent VolatileImg Image",
|
||||
};
|
||||
|
||||
public static final String[] ModifierNames = {
|
||||
"VolatileImg()",
|
||||
"VolatileImg(Opaque)",
|
||||
"VolatileImg(Bitmask)",
|
||||
"VolatileImg(Translucent)",
|
||||
};
|
||||
|
||||
public VolatileImg() {
|
||||
super(destroot, "volimg", "Output to Volatile Image", false);
|
||||
this(0);
|
||||
}
|
||||
|
||||
public String getModifierValueName(Object val) {
|
||||
return "VolatileImg";
|
||||
public VolatileImg(final int transparency) {
|
||||
super(volimgdestroot,
|
||||
ShortNames[transparency],
|
||||
ShortDescriptions[transparency],
|
||||
false);
|
||||
this.transparency = transparency;
|
||||
}
|
||||
|
||||
public void setDestination(TestEnvironment env) {
|
||||
public String getModifierValueName(final Object val) {
|
||||
return ModifierNames[transparency];
|
||||
}
|
||||
|
||||
public void setDestination(final TestEnvironment env) {
|
||||
Component c = env.getCanvas();
|
||||
env.setTestImage(c.createVolatileImage(env.getWidth(),
|
||||
env.getHeight()));
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
int w = env.getWidth();
|
||||
int h = env.getHeight();
|
||||
if (transparency == 0) {
|
||||
env.setTestImage(gc.createCompatibleVolatileImage(w, h));
|
||||
} else {
|
||||
env.setTestImage(gc.createCompatibleVolatileImage(w, h, transparency));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, 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
|
||||
@ -44,6 +44,7 @@ import java.io.PrintWriter;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import java.util.NoSuchElementException;
|
||||
@ -199,7 +200,7 @@ public class Group extends Node {
|
||||
p.add(comp);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
return new JScrollPane(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, 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
|
||||
@ -60,6 +60,8 @@ import javax.swing.JPanel;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@ -376,7 +378,11 @@ public class J2DBench {
|
||||
}
|
||||
|
||||
if (gui) {
|
||||
startGUI();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
startGUI();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
@ -772,6 +778,7 @@ public class J2DBench {
|
||||
|
||||
f.getContentPane().add(p, BorderLayout.SOUTH);
|
||||
f.pack();
|
||||
f.setLocationRelativeTo(null);
|
||||
f.show();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, 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
|
||||
@ -112,10 +112,10 @@ public abstract class GraphicsTests extends Test {
|
||||
|
||||
sizeList = new Option.IntList(groptroot, "sizes",
|
||||
"Size of Operations to perform",
|
||||
new int[] {1, 20, 100, 250, 1000},
|
||||
new int[] {1, 20, 100, 250, 1000, 4000},
|
||||
new String[] {
|
||||
"1x1", "20x20", "100x100", "250x250",
|
||||
"1000x1000",
|
||||
"1000x1000", "4000x4000",
|
||||
},
|
||||
new String[] {
|
||||
"Tiny Shapes (1x1)",
|
||||
@ -123,6 +123,7 @@ public abstract class GraphicsTests extends Test {
|
||||
"Medium Shapes (100x100)",
|
||||
"Large Shapes (250x250)",
|
||||
"X-Large Shapes (1000x1000)",
|
||||
"Huge Shapes (4000x4000)",
|
||||
}, 0xa);
|
||||
if (hasGraphics2D) {
|
||||
String rulenames[] = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2014, 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
|
||||
@ -53,6 +53,7 @@ import java.awt.Canvas;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
import java.awt.image.ByteLookupTable;
|
||||
@ -77,6 +78,7 @@ import javax.swing.JComponent;
|
||||
|
||||
public abstract class ImageTests extends GraphicsTests {
|
||||
public static boolean hasVolatileImage;
|
||||
public static boolean hasTransparentVolatileImage;
|
||||
public static boolean hasCompatImage;
|
||||
|
||||
static {
|
||||
@ -89,14 +91,20 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
hasCompatImage = true;
|
||||
} catch (NoSuchMethodError e) {
|
||||
}
|
||||
try {
|
||||
new Canvas().getMousePosition();
|
||||
hasTransparentVolatileImage = true;
|
||||
} catch (NoSuchMethodError e) {
|
||||
}
|
||||
}
|
||||
|
||||
static Group imageroot;
|
||||
static Group.EnableSet imgsrcroot;
|
||||
static Group.EnableSet bufimgsrcroot;
|
||||
|
||||
static Group imgbenchroot;
|
||||
static Group imgtestroot;
|
||||
static Group imgoptionsroot;
|
||||
static Group imgtestOptRoot;
|
||||
|
||||
static Group imageOpRoot;
|
||||
static Group imageOpOptRoot;
|
||||
@ -106,6 +114,7 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
static Group rasterOpTestRoot;
|
||||
static Option opList;
|
||||
static Option doTouchSrc;
|
||||
static Option interpolation;
|
||||
|
||||
static String transNodeNames[] = {
|
||||
null, "opaque", "bitmask", "translucent",
|
||||
@ -122,19 +131,9 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
|
||||
imgsrcroot = new Group.EnableSet(imageroot, "src",
|
||||
"Image Rendering Sources");
|
||||
imgsrcroot.setBordered(true);
|
||||
|
||||
imgoptionsroot = new Group(imgsrcroot, "options",
|
||||
"Image Source Options");
|
||||
imgoptionsroot.setBordered(true);
|
||||
doTouchSrc =
|
||||
new Option.Toggle(imgoptionsroot, "touchsrc",
|
||||
"Touch src image before every operation",
|
||||
Option.Toggle.Off);
|
||||
|
||||
imgtestroot = new Group(imageroot, "tests",
|
||||
"Image Rendering Tests");
|
||||
imgtestroot.setBordered(true);
|
||||
imgbenchroot = new Group(imageroot, "benchmarks",
|
||||
"Image Rendering Benchmarks");
|
||||
imgtestOptRoot = new Group(imgbenchroot, "opts", "Options");
|
||||
|
||||
new OffScreen();
|
||||
|
||||
@ -144,9 +143,14 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
new CompatImg(Transparency.BITMASK);
|
||||
new CompatImg(Transparency.TRANSLUCENT);
|
||||
}
|
||||
|
||||
if (hasVolatileImage) {
|
||||
new VolatileImg();
|
||||
if (hasTransparentVolatileImage) {
|
||||
new VolatileImg(Transparency.OPAQUE);
|
||||
new VolatileImg(Transparency.BITMASK);
|
||||
new VolatileImg(Transparency.TRANSLUCENT);
|
||||
} else {
|
||||
new VolatileImg();
|
||||
}
|
||||
}
|
||||
|
||||
bufimgsrcroot =
|
||||
@ -154,11 +158,15 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
"BufferedImage Rendering Sources");
|
||||
new BufImg(BufferedImage.TYPE_INT_RGB);
|
||||
new BufImg(BufferedImage.TYPE_INT_ARGB);
|
||||
new BufImg(BufferedImage.TYPE_INT_ARGB_PRE);
|
||||
new BufImg(BufferedImage.TYPE_BYTE_GRAY);
|
||||
new BufImg(BufferedImage.TYPE_3BYTE_BGR);
|
||||
new BufImg(BufferedImage.TYPE_4BYTE_ABGR);
|
||||
new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE);
|
||||
new BmByteIndexBufImg();
|
||||
new BufImg(BufferedImage.TYPE_INT_RGB, true);
|
||||
new BufImg(BufferedImage.TYPE_INT_ARGB, true);
|
||||
new BufImg(BufferedImage.TYPE_INT_ARGB_PRE, true);
|
||||
new BufImg(BufferedImage.TYPE_3BYTE_BGR, true);
|
||||
|
||||
imageOpRoot = new Group(imageroot, "imageops",
|
||||
@ -211,12 +219,31 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
new BufImgOpFilter(true);
|
||||
new RasterOpFilter(false);
|
||||
new RasterOpFilter(true);
|
||||
|
||||
String interpolationnames[] = {"Nearest neighbor", "Bilinear",
|
||||
"Bicubic",};
|
||||
interpolation =
|
||||
new ObjectList(imgtestOptRoot, "interpolation",
|
||||
"Interpolation",
|
||||
interpolationnames, new Object[] {
|
||||
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
|
||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
|
||||
RenderingHints.VALUE_INTERPOLATION_BICUBIC,
|
||||
}, interpolationnames, interpolationnames, 1);
|
||||
}
|
||||
|
||||
doTouchSrc =
|
||||
new Option.Toggle(imgtestOptRoot, "touchsrc",
|
||||
"Touch source image before every operation",
|
||||
Option.Toggle.Off);
|
||||
|
||||
imgtestroot = new Group(imgbenchroot, "tests", "Image Rendering Tests");
|
||||
|
||||
new DrawImage();
|
||||
new DrawImageBg();
|
||||
new DrawImageScale("up", 1.5f);
|
||||
new DrawImageScale("down", .75f);
|
||||
new DrawImageScale("split", .5f);
|
||||
new DrawImageTransform();
|
||||
}
|
||||
|
||||
@ -236,6 +263,7 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
super(parent, nodeName, description);
|
||||
addDependency(imgsrcroot, srcFilter);
|
||||
addDependency(doTouchSrc);
|
||||
addDependency(interpolation);
|
||||
}
|
||||
|
||||
public GraphicsTests.Context createContext() {
|
||||
@ -248,6 +276,11 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
|
||||
ictx.src = env.getSrcImage();
|
||||
ictx.touchSrc = env.isEnabled(doTouchSrc);
|
||||
if (hasGraphics2D) {
|
||||
Graphics2D g2d = (Graphics2D) ctx.graphics;
|
||||
final Object modifier = env.getModifier(interpolation);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, modifier);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class TriStateImageType extends Group {
|
||||
@ -290,13 +323,27 @@ public abstract class ImageTests extends GraphicsTests {
|
||||
}
|
||||
|
||||
public static class VolatileImg extends TriStateImageType {
|
||||
private final int transparency;
|
||||
|
||||
public VolatileImg() {
|
||||
super(imgsrcroot, "volimg", "Volatile Image", Transparency.OPAQUE);
|
||||
this(0);
|
||||
}
|
||||
|
||||
public VolatileImg(int transparency) {
|
||||
super(imgsrcroot, Destinations.VolatileImg.ShortNames[transparency],
|
||||
Destinations.VolatileImg.LongDescriptions[transparency],
|
||||
transparency);
|
||||
this.transparency = transparency;
|
||||
}
|
||||
|
||||
public Image makeImage(TestEnvironment env, int w, int h) {
|
||||
Canvas c = env.getCanvas();
|
||||
return c.createVolatileImage(w, h);
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
if (transparency == 0) {
|
||||
return gc.createCompatibleVolatileImage(w, h);
|
||||
} else {
|
||||
return gc.createCompatibleVolatileImage(w, h, transparency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ import j2dbench.tests.iio.IIOTests;
|
||||
public class ColorConvertOpTests extends ColorConversionTests {
|
||||
|
||||
private static class ImageContent {
|
||||
static ImageContent BLANK = new ImageContent("bank", "Blank (opaque black)");
|
||||
static ImageContent BLANK = new ImageContent("blank", "Blank (opaque black)");
|
||||
static ImageContent RANDOM = new ImageContent("random", "Random");
|
||||
static ImageContent VECTOR = new ImageContent("vector", "Vector Art");
|
||||
static ImageContent PHOTO= new ImageContent("photo", "Photograph");
|
||||
@ -83,7 +83,7 @@ public class ColorConvertOpTests extends ColorConversionTests {
|
||||
static ImageType INT_RGB = new ImageType(BufferedImage.TYPE_INT_RGB, "INT_RGB", "TYPE_INT_RGB");
|
||||
static ImageType INT_BGR = new ImageType(BufferedImage.TYPE_INT_BGR, "INT_BGR", "TYPE_INT_BGR");
|
||||
static ImageType BYTE_3BYTE_BGR = new ImageType(BufferedImage.TYPE_3BYTE_BGR, "3BYTE_BGR", "TYPE_3BYTE_BGR");
|
||||
static ImageType BYTE_4BYTE_ABGR = new ImageType(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_BGR", "TYPE_4BYTE_BGR");
|
||||
static ImageType BYTE_4BYTE_ABGR = new ImageType(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_ABGR", "TYPE_4BYTE_ABGR");
|
||||
static ImageType COMPATIBLE_DST = new ImageType(0, "Compatible", "Compatible destination");
|
||||
|
||||
private ImageType(int type, String abbr, String descr) {
|
||||
@ -130,7 +130,7 @@ public class ColorConvertOpTests extends ColorConversionTests {
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
t[i] = allTypes[i];
|
||||
names[i] = t[i].toString();
|
||||
names[i] = t[i].abbrev;
|
||||
abbrev[i] = t[i].abbrev;
|
||||
descr[i] = t[i].descr;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class EmbeddedProfileTests extends ColorConversionTests {
|
||||
String[] descr = new String[num];
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
names[i] = images[i].toString();
|
||||
names[i] = images[i].abbrev;
|
||||
abbrev[i] = images[i].abbrev;
|
||||
descr[i] = images[i].description;
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class EmbeddedProfileTests extends ColorConversionTests {
|
||||
iis = ImageIO.createImageInputStream(url.openStream());
|
||||
reader = (ImageReader) ImageIO.getImageReaders(iis).next();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Unable to run the becnhmark", e);
|
||||
throw new RuntimeException("Unable to run the benchmark", e);
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -267,7 +267,7 @@ public final class TableSorter extends TableMap {
|
||||
than assigned otherwise sister calls in the recursion might
|
||||
get out of sinc. When the number of elements is three they
|
||||
are partitioned so that the first set, [low, mid), has one
|
||||
element and and the second, [mid, high), has two. We skip the
|
||||
element and the second, [mid, high), has two. We skip the
|
||||
optimisation when the number of elements is three or less as
|
||||
the first compare in the normal merge will produce the same
|
||||
sequence of steps. This optimisation seems to be worthwhile
|
||||
|
@ -497,7 +497,7 @@ class ClassReader {
|
||||
code.max_locals >= TOO_BIG ||
|
||||
code.getLength() >= TOO_BIG ||
|
||||
name.endsWith("X")) {
|
||||
// No, we don't really know what to do this this one.
|
||||
// No, we don't really know what to do with this one.
|
||||
// Do not compress the rare and strange "u4" and "X" cases.
|
||||
a = null;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class Coding implements Comparable<Coding>, CodingMethod, Histogram.BitMetric {
|
||||
If S>0, the unsigned value of a byte sequence is regarded as a binary
|
||||
integer. If any of the S low-order bits are zero, the corresponding
|
||||
signed value will be non-negative. If all of the S low-order bits
|
||||
(S>0) are one, the the corresponding signed value will be negative.
|
||||
(S>0) are one, the corresponding signed value will be negative.
|
||||
|
||||
The non-negative signed values are compact and monotonically increasing
|
||||
(from 0) in the ordering of the corresponding unsigned values.
|
||||
|
@ -26,6 +26,7 @@
|
||||
package java.io;
|
||||
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
|
||||
|
||||
@ -57,10 +58,9 @@ class FileInputStream extends InputStream
|
||||
*/
|
||||
private final String path;
|
||||
|
||||
private FileChannel channel = null;
|
||||
private volatile FileChannel channel;
|
||||
|
||||
private final Object closeLock = new Object();
|
||||
private volatile boolean closed = false;
|
||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Creates a <code>FileInputStream</code> by
|
||||
@ -313,14 +313,14 @@ class FileInputStream extends InputStream
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
synchronized (closeLock) {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
closed = true;
|
||||
if (!closed.compareAndSet(false, true)) {
|
||||
// if compareAndSet() returns false closed was already true
|
||||
return;
|
||||
}
|
||||
if (channel != null) {
|
||||
channel.close();
|
||||
|
||||
FileChannel fc = channel;
|
||||
if (fc != null) {
|
||||
fc.close();
|
||||
}
|
||||
|
||||
fd.closeAll(new Closeable() {
|
||||
@ -364,12 +364,23 @@ class FileInputStream extends InputStream
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public FileChannel getChannel() {
|
||||
synchronized (this) {
|
||||
if (channel == null) {
|
||||
channel = FileChannelImpl.open(fd, path, true, false, this);
|
||||
FileChannel fc = this.channel;
|
||||
if (fc == null) {
|
||||
synchronized (this) {
|
||||
fc = this.channel;
|
||||
if (fc == null) {
|
||||
this.channel = fc = FileChannelImpl.open(fd, path, true, false, this);
|
||||
if (closed.get()) {
|
||||
try {
|
||||
fc.close();
|
||||
} catch (IOException ioe) {
|
||||
throw new InternalError(ioe); // should not happen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
|
||||
private static native void initIDs();
|
||||
|
@ -26,6 +26,7 @@
|
||||
package java.io;
|
||||
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
@ -68,7 +69,7 @@ class FileOutputStream extends OutputStream
|
||||
/**
|
||||
* The associated channel, initialized lazily.
|
||||
*/
|
||||
private FileChannel channel;
|
||||
private volatile FileChannel channel;
|
||||
|
||||
/**
|
||||
* The path of the referenced file
|
||||
@ -76,8 +77,7 @@ class FileOutputStream extends OutputStream
|
||||
*/
|
||||
private final String path;
|
||||
|
||||
private final Object closeLock = new Object();
|
||||
private volatile boolean closed = false;
|
||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
||||
|
||||
/**
|
||||
* Creates a file output stream to write to the file with the
|
||||
@ -341,15 +341,14 @@ class FileOutputStream extends OutputStream
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
synchronized (closeLock) {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
closed = true;
|
||||
if (!closed.compareAndSet(false, true)) {
|
||||
// if compareAndSet() returns false closed was already true
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel != null) {
|
||||
channel.close();
|
||||
FileChannel fc = channel;
|
||||
if (fc != null) {
|
||||
fc.close();
|
||||
}
|
||||
|
||||
fd.closeAll(new Closeable() {
|
||||
@ -394,12 +393,23 @@ class FileOutputStream extends OutputStream
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public FileChannel getChannel() {
|
||||
synchronized (this) {
|
||||
if (channel == null) {
|
||||
channel = FileChannelImpl.open(fd, path, false, true, this);
|
||||
FileChannel fc = this.channel;
|
||||
if (fc == null) {
|
||||
synchronized (this) {
|
||||
fc = this.channel;
|
||||
if (fc == null) {
|
||||
this.channel = fc = FileChannelImpl.open(fd, path, false, true, this);
|
||||
if (closed.get()) {
|
||||
try {
|
||||
fc.close();
|
||||
} catch (IOException ioe) {
|
||||
throw new InternalError(ioe); // should not happen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package java.io;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This abstract class is the superclass of all classes representing
|
||||
* an input stream of bytes.
|
||||
@ -48,6 +50,8 @@ public abstract class InputStream implements Closeable {
|
||||
// use when skipping.
|
||||
private static final int MAX_SKIP_BUFFER_SIZE = 2048;
|
||||
|
||||
private static final int TRANSFER_BUFFER_SIZE = 8192;
|
||||
|
||||
/**
|
||||
* Reads the next byte of data from the input stream. The value byte is
|
||||
* returned as an <code>int</code> in the range <code>0</code> to
|
||||
@ -364,4 +368,40 @@ public abstract class InputStream implements Closeable {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads all bytes from this input stream and writes the bytes to the
|
||||
* given output stream in the order that they are read. On return, this
|
||||
* input stream will be at end of stream. This method does not close either
|
||||
* stream.
|
||||
* <p>
|
||||
* This method may block indefinitely reading from the input stream, or
|
||||
* writing to the output stream. The behavior for the case where the input
|
||||
* and/or output stream is <i>asynchronously closed</i>, or the thread
|
||||
* interrupted during the transfer, is highly input and output stream
|
||||
* specific, and therefore not specified.
|
||||
* <p>
|
||||
* If an I/O error occurs reading from the input stream or writing to the
|
||||
* output stream, then it may do so after some bytes have been read or
|
||||
* written. Consequently the input stream may not be at end of stream and
|
||||
* one, or both, streams may be in an inconsistent state. It is strongly
|
||||
* recommended that both streams be promptly closed if an I/O error occurs.
|
||||
*
|
||||
* @param out the output stream, non-null
|
||||
* @return the number of bytes transferred
|
||||
* @throws IOException if an I/O error occurs when reading or writing
|
||||
* @throws NullPointerException if {@code out} is {@code null}
|
||||
*
|
||||
* @since 1.9
|
||||
*/
|
||||
public long transferTo(OutputStream out) throws IOException {
|
||||
Objects.requireNonNull(out, "out");
|
||||
long transferred = 0;
|
||||
byte[] buffer = new byte[TRANSFER_BUFFER_SIZE];
|
||||
int read;
|
||||
while ((read = this.read(buffer, 0, TRANSFER_BUFFER_SIZE)) >= 0) {
|
||||
out.write(buffer, 0, read);
|
||||
transferred += read;
|
||||
}
|
||||
return transferred;
|
||||
}
|
||||
}
|
||||
|
@ -2345,7 +2345,7 @@ public class ObjectInputStream
|
||||
skipped++;
|
||||
n--;
|
||||
}
|
||||
return skipped + skip(n);
|
||||
return skipped + in.skip(n);
|
||||
}
|
||||
|
||||
public int available() throws IOException {
|
||||
|
@ -26,6 +26,7 @@
|
||||
package java.io;
|
||||
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
|
||||
|
||||
@ -59,7 +60,7 @@ import sun.nio.ch.FileChannelImpl;
|
||||
public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
|
||||
private FileDescriptor fd;
|
||||
private FileChannel channel = null;
|
||||
private volatile FileChannel channel;
|
||||
private boolean rw;
|
||||
|
||||
/**
|
||||
@ -68,8 +69,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
*/
|
||||
private final String path;
|
||||
|
||||
private Object closeLock = new Object();
|
||||
private volatile boolean closed = false;
|
||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
||||
|
||||
private static final int O_RDONLY = 1;
|
||||
private static final int O_RDWR = 2;
|
||||
@ -276,13 +276,24 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
* @since 1.4
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public final FileChannel getChannel() {
|
||||
synchronized (this) {
|
||||
if (channel == null) {
|
||||
channel = FileChannelImpl.open(fd, path, true, rw, this);
|
||||
public FileChannel getChannel() {
|
||||
FileChannel fc = this.channel;
|
||||
if (fc == null) {
|
||||
synchronized (this) {
|
||||
fc = this.channel;
|
||||
if (fc == null) {
|
||||
this.channel = fc = FileChannelImpl.open(fd, path, true, rw, this);
|
||||
if (closed.get()) {
|
||||
try {
|
||||
fc.close();
|
||||
} catch (IOException ioe) {
|
||||
throw new InternalError(ioe); // should not happen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return channel;
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -604,14 +615,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
|
||||
* @spec JSR-51
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
synchronized (closeLock) {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
closed = true;
|
||||
if (!closed.compareAndSet(false, true)) {
|
||||
// if compareAndSet() returns false closed was already true
|
||||
return;
|
||||
}
|
||||
if (channel != null) {
|
||||
channel.close();
|
||||
|
||||
FileChannel fc = channel;
|
||||
if (fc != null) {
|
||||
fc.close();
|
||||
}
|
||||
|
||||
fd.closeAll(new Closeable() {
|
||||
|
@ -1529,7 +1529,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* the accessible public fields of the class or interface represented by
|
||||
* this {@code Class} object.
|
||||
*
|
||||
* <p> If this {@code Class} object represents a class or interface with no
|
||||
* <p> If this {@code Class} object represents a class or interface with
|
||||
* no accessible public fields, then this method returns an array of length
|
||||
* 0.
|
||||
*
|
||||
|
@ -162,7 +162,7 @@ public abstract class ClassValue<T> {
|
||||
* observe the time-dependent states as it computes {@code V1}, etc.
|
||||
* This does not remove the threat of a stale value, since there is a window of time
|
||||
* between the return of {@code computeValue} in {@code T} and the installation
|
||||
* of the the new value. No user synchronization is possible during this time.
|
||||
* of the new value. No user synchronization is possible during this time.
|
||||
*
|
||||
* @param type the type whose class value must be removed
|
||||
* @throws NullPointerException if the argument is null
|
||||
@ -285,7 +285,7 @@ public abstract class ClassValue<T> {
|
||||
* will receive the notification without delay.
|
||||
* <p>
|
||||
* If version were not volatile, one thread T1 could persistently hold onto
|
||||
* a stale value this.value == V1, while while another thread T2 advances
|
||||
* a stale value this.value == V1, while another thread T2 advances
|
||||
* (under a lock) to this.value == V2. This will typically be harmless,
|
||||
* but if T1 and T2 interact causally via some other channel, such that
|
||||
* T1's further actions are constrained (in the JMM) to happen after
|
||||
|
@ -840,7 +840,7 @@ public final class Integer extends Number implements Comparable<Integer> {
|
||||
/**
|
||||
* Parses the string argument as an unsigned decimal integer. The
|
||||
* characters in the string must all be decimal digits, except
|
||||
* that the first character may be an an ASCII plus sign {@code
|
||||
* that the first character may be an ASCII plus sign {@code
|
||||
* '+'} ({@code '\u005Cu002B'}). The resulting integer value
|
||||
* is returned, exactly as if the argument and the radix 10 were
|
||||
* given as arguments to the {@link
|
||||
|
@ -971,7 +971,7 @@ public final class Long extends Number implements Comparable<Long> {
|
||||
/**
|
||||
* Parses the string argument as an unsigned decimal {@code long}. The
|
||||
* characters in the string must all be decimal digits, except
|
||||
* that the first character may be an an ASCII plus sign {@code
|
||||
* that the first character may be an ASCII plus sign {@code
|
||||
* '+'} ({@code '\u005Cu002B'}). The resulting integer value
|
||||
* is returned, exactly as if the argument and the radix 10 were
|
||||
* given as arguments to the {@link
|
||||
|
@ -2224,7 +2224,7 @@ public final class Math {
|
||||
* multiply-store result is subnormal, the next multiply will
|
||||
* round it away to zero. This is done by first multiplying
|
||||
* by 2 ^ (scaleFactor % n) and then multiplying several
|
||||
* times by by 2^n as needed where n is the exponent of number
|
||||
* times by 2^n as needed where n is the exponent of number
|
||||
* that is a covenient power of two. In this way, at most one
|
||||
* real rounding error occurs. If the double value set is
|
||||
* being used exclusively, the rounding will occur on a
|
||||
@ -2249,7 +2249,7 @@ public final class Math {
|
||||
|
||||
// magnitude of a power of two so large that scaling a finite
|
||||
// nonzero value by it would be guaranteed to over or
|
||||
// underflow; due to rounding, scaling down takes takes an
|
||||
// underflow; due to rounding, scaling down takes an
|
||||
// additional power of two which is reflected here
|
||||
final int MAX_SCALE = DoubleConsts.MAX_EXPONENT + -DoubleConsts.MIN_EXPONENT +
|
||||
DoubleConsts.SIGNIFICAND_WIDTH + 1;
|
||||
@ -2318,7 +2318,7 @@ public final class Math {
|
||||
public static float scalb(float f, int scaleFactor) {
|
||||
// magnitude of a power of two so large that scaling a finite
|
||||
// nonzero value by it would be guaranteed to over or
|
||||
// underflow; due to rounding, scaling down takes takes an
|
||||
// underflow; due to rounding, scaling down takes an
|
||||
// additional power of two which is reflected here
|
||||
final int MAX_SCALE = FloatConsts.MAX_EXPONENT + -FloatConsts.MIN_EXPONENT +
|
||||
FloatConsts.SIGNIFICAND_WIDTH + 1;
|
||||
|
@ -750,7 +750,7 @@ public final class ProcessBuilder
|
||||
* {@link Process#getErrorStream()} will return a
|
||||
* <a href="#redirect-output">null input stream</a>.
|
||||
*
|
||||
* <p>If the {@link #redirectErrorStream redirectErrorStream}
|
||||
* <p>If the {@link #redirectErrorStream() redirectErrorStream}
|
||||
* attribute has been set {@code true}, then the redirection set
|
||||
* by this method has no effect.
|
||||
*
|
||||
|
@ -202,7 +202,7 @@ public class Throwable implements Serializable {
|
||||
* The field is initialized to a zero-length array. A {@code
|
||||
* null} value of this field indicates subsequent calls to {@link
|
||||
* #setStackTrace(StackTraceElement[])} and {@link
|
||||
* #fillInStackTrace()} will be be no-ops.
|
||||
* #fillInStackTrace()} will be no-ops.
|
||||
*
|
||||
* @serial
|
||||
* @since 1.4
|
||||
|
@ -116,7 +116,7 @@ class MethodType implements java.io.Serializable {
|
||||
/**
|
||||
* Construct a temporary unchecked instance of MethodType for use only as a key to the intern table.
|
||||
* Does not check the given parameters for validity, and must be discarded after it is used as a searching key.
|
||||
* The parameters are reversed for this constructor, so that is is not accidentally used.
|
||||
* The parameters are reversed for this constructor, so that it is not accidentally used.
|
||||
*/
|
||||
private MethodType(Class<?>[] ptypes, Class<?> rtype) {
|
||||
this.rtype = rtype;
|
||||
@ -1006,7 +1006,7 @@ class MethodType implements java.io.Serializable {
|
||||
* Therefore, the number returned is the number of arguments
|
||||
* <em>including</em> and <em>after</em> the given parameter,
|
||||
* <em>plus</em> the number of long or double arguments
|
||||
* at or after after the argument for the given parameter.
|
||||
* at or after the argument for the given parameter.
|
||||
* <p>
|
||||
* This method is included for the benefit of applications that must
|
||||
* generate bytecodes that process method handles and invokedynamic.
|
||||
|
@ -92,7 +92,7 @@ public interface DomainCombiner {
|
||||
* @param currentDomains the ProtectionDomains associated with the
|
||||
* current execution Thread, up to the most recent
|
||||
* privileged {@code ProtectionDomain}.
|
||||
* The ProtectionDomains are are listed in order of execution,
|
||||
* The ProtectionDomains are listed in order of execution,
|
||||
* with the most recently executing {@code ProtectionDomain}
|
||||
* residing at the beginning of the array. This parameter may
|
||||
* be {@code null} if the current execution Thread
|
||||
|
@ -1711,7 +1711,7 @@ public abstract class Provider extends Properties {
|
||||
*
|
||||
* @param parameter the parameter to test
|
||||
*
|
||||
* @return false if this this service cannot use the specified
|
||||
* @return false if this service cannot use the specified
|
||||
* parameter; true if it can possibly use the parameter
|
||||
*
|
||||
* @throws InvalidParameterException if the value of parameter is
|
||||
|
@ -776,7 +776,7 @@ public abstract class Signature extends SignatureSpi {
|
||||
/**
|
||||
* Updates the data to be signed or verified using the specified
|
||||
* ByteBuffer. Processes the {@code data.remaining()} bytes
|
||||
* starting at at {@code data.position()}.
|
||||
* starting at {@code data.position()}.
|
||||
* Upon return, the buffer's position will be equal to its limit;
|
||||
* its limit will not have changed.
|
||||
*
|
||||
|
@ -131,7 +131,7 @@ public abstract class SignatureSpi {
|
||||
/**
|
||||
* Updates the data to be signed or verified using the specified
|
||||
* ByteBuffer. Processes the {@code data.remaining()} bytes
|
||||
* starting at at {@code data.position()}.
|
||||
* starting at {@code data.position()}.
|
||||
* Upon return, the buffer's position will be equal to its limit;
|
||||
* its limit will not have changed.
|
||||
*
|
||||
|
@ -54,7 +54,7 @@ import java.security.*;
|
||||
*
|
||||
* </ol>
|
||||
*
|
||||
* <p>Note: it is not always necessary to do do algorithm-specific
|
||||
* <p>Note: it is not always necessary to do algorithm-specific
|
||||
* initialization for a DSA key pair generator. That is, it is not always
|
||||
* necessary to call an {@code initialize} method in this interface.
|
||||
* Algorithm-independent initialization using the {@code initialize} method
|
||||
|
@ -1097,7 +1097,7 @@ public final class DateTimeFormatter {
|
||||
* This returns an immutable formatter capable of formatting and parsing
|
||||
* the ISO-8601 instant format.
|
||||
* When formatting, the second-of-minute is always output.
|
||||
* The nano-of-second outputs zero, three, six or nine digits digits as necessary.
|
||||
* The nano-of-second outputs zero, three, six or nine digits as necessary.
|
||||
* When parsing, time to at least the seconds field is required.
|
||||
* Fractional seconds from zero to nine are parsed.
|
||||
* The localized decimal style is not used.
|
||||
|
@ -793,7 +793,7 @@ public final class DateTimeFormatterBuilder {
|
||||
* They are converted to a date-time with a zone-offset of UTC and formatted
|
||||
* using the standard ISO-8601 format.
|
||||
* With this method, formatting nano-of-second outputs zero, three, six
|
||||
* or nine digits digits as necessary.
|
||||
* or nine digits as necessary.
|
||||
* The localized decimal style is not used.
|
||||
* <p>
|
||||
* The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
|
||||
|
@ -1221,7 +1221,7 @@ public class Arrays {
|
||||
*
|
||||
* <p>The implementation takes equal advantage of ascending and
|
||||
* descending order in its input array, and can take advantage of
|
||||
* ascending and descending order in different parts of the the same
|
||||
* ascending and descending order in different parts of the same
|
||||
* input array. It is well-suited to merging two or more sorted arrays:
|
||||
* simply concatenate the arrays and sort the resulting array.
|
||||
*
|
||||
@ -1280,7 +1280,7 @@ public class Arrays {
|
||||
*
|
||||
* <p>The implementation takes equal advantage of ascending and
|
||||
* descending order in its input array, and can take advantage of
|
||||
* ascending and descending order in different parts of the the same
|
||||
* ascending and descending order in different parts of the same
|
||||
* input array. It is well-suited to merging two or more sorted arrays:
|
||||
* simply concatenate the arrays and sort the resulting array.
|
||||
*
|
||||
@ -1407,7 +1407,7 @@ public class Arrays {
|
||||
*
|
||||
* <p>The implementation takes equal advantage of ascending and
|
||||
* descending order in its input array, and can take advantage of
|
||||
* ascending and descending order in different parts of the the same
|
||||
* ascending and descending order in different parts of the same
|
||||
* input array. It is well-suited to merging two or more sorted arrays:
|
||||
* simply concatenate the arrays and sort the resulting array.
|
||||
*
|
||||
@ -1473,7 +1473,7 @@ public class Arrays {
|
||||
*
|
||||
* <p>The implementation takes equal advantage of ascending and
|
||||
* descending order in its input array, and can take advantage of
|
||||
* ascending and descending order in different parts of the the same
|
||||
* ascending and descending order in different parts of the same
|
||||
* input array. It is well-suited to merging two or more sorted arrays:
|
||||
* simply concatenate the arrays and sort the resulting array.
|
||||
*
|
||||
|
@ -556,7 +556,7 @@ public class Base64 {
|
||||
*
|
||||
* <p> It is the responsibility of the invoker of this method to make
|
||||
* sure the output byte array {@code dst} has enough space for decoding
|
||||
* all bytes from the input byte array. No bytes will be be written to
|
||||
* all bytes from the input byte array. No bytes will be written to
|
||||
* the output byte array if the output byte array is not big enough.
|
||||
*
|
||||
* <p> If the input byte array is not in valid Base64 encoding scheme
|
||||
|
@ -2993,7 +2993,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the date of this {@code Calendar} with the the given date
|
||||
* Sets the date of this {@code Calendar} with the given date
|
||||
* specifiers - week year, week of year, and day of week.
|
||||
*
|
||||
* <p>Unlike the {@code set} method, all of the calendar fields
|
||||
|
@ -95,7 +95,7 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
||||
* <code>Locale</code> always canonicalizes to lower case.</dd>
|
||||
*
|
||||
* <dd>Well-formed language values have the form
|
||||
* <code>[a-zA-Z]{2,8}</code>. Note that this is not the the full
|
||||
* <code>[a-zA-Z]{2,8}</code>. Note that this is not the full
|
||||
* BCP47 language production, since it excludes extlang. They are
|
||||
* not needed since modern three-letter language codes replace
|
||||
* them.</dd>
|
||||
@ -1691,7 +1691,7 @@ public final class Locale implements Cloneable, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a name for the the locale's script that is appropriate for display to
|
||||
* Returns a name for the locale's script that is appropriate for display to
|
||||
* the user. If possible, the name will be localized for the default
|
||||
* {@link Locale.Category#DISPLAY DISPLAY} locale. Returns
|
||||
* the empty string if this locale doesn't specify a script code.
|
||||
|
@ -994,7 +994,7 @@ public abstract class ResourceBundle {
|
||||
* bundle is found, the default control's {@link Control#getFallbackLocale
|
||||
* getFallbackLocale} method is called, which returns the current default
|
||||
* locale. A new sequence of candidate locale names is generated using this
|
||||
* locale and and searched again, as above.
|
||||
* locale and searched again, as above.
|
||||
*
|
||||
* <p>If still no result bundle is found, the base name alone is looked up. If
|
||||
* this still fails, a <code>MissingResourceException</code> is thrown.
|
||||
|
@ -84,7 +84,7 @@ import java.util.function.LongConsumer;
|
||||
* via the {@link #estimateSize} method. Ideally, as reflected in characteristic
|
||||
* {@link #SIZED}, this value corresponds exactly to the number of elements
|
||||
* that would be encountered in a successful traversal. However, even when not
|
||||
* exactly known, an estimated value value may still be useful to operations
|
||||
* exactly known, an estimated value may still be useful to operations
|
||||
* being performed on the source, such as helping to determine whether it is
|
||||
* preferable to split further or traverse the remaining elements sequentially.
|
||||
*
|
||||
|
@ -132,7 +132,7 @@ public final class Spliterators {
|
||||
* @param array The array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @see Arrays#spliterator(Object[])
|
||||
@ -164,7 +164,7 @@ public final class Spliterators {
|
||||
* @param toIndex One past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
|
||||
@ -196,7 +196,7 @@ public final class Spliterators {
|
||||
* @param array The array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @see Arrays#spliterator(int[])
|
||||
@ -226,7 +226,7 @@ public final class Spliterators {
|
||||
* @param toIndex One past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
|
||||
@ -258,7 +258,7 @@ public final class Spliterators {
|
||||
* @param array The array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @see Arrays#spliterator(long[])
|
||||
@ -282,7 +282,7 @@ public final class Spliterators {
|
||||
* {@code SIZED} and {@code SUBSIZED}. The caller may provide additional
|
||||
* characteristics for the spliterator to report. (For example, if it is
|
||||
* known the array will not be further modified, specify {@code IMMUTABLE};
|
||||
* if the array data is considered to have an an encounter order, specify
|
||||
* if the array data is considered to have an encounter order, specify
|
||||
* {@code ORDERED}). The method {@link Arrays#spliterator(long[], int, int)} can
|
||||
* often be used instead, which returns a spliterator that reports
|
||||
* {@code SIZED}, {@code SUBSIZED}, {@code IMMUTABLE}, and {@code ORDERED}.
|
||||
@ -292,7 +292,7 @@ public final class Spliterators {
|
||||
* @param toIndex One past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
|
||||
@ -324,7 +324,7 @@ public final class Spliterators {
|
||||
* @param array The array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @see Arrays#spliterator(double[])
|
||||
@ -348,7 +348,7 @@ public final class Spliterators {
|
||||
* {@code SIZED} and {@code SUBSIZED}. The caller may provide additional
|
||||
* characteristics for the spliterator to report. (For example, if it is
|
||||
* known the array will not be further modified, specify {@code IMMUTABLE};
|
||||
* if the array data is considered to have an an encounter order, specify
|
||||
* if the array data is considered to have an encounter order, specify
|
||||
* {@code ORDERED}). The method {@link Arrays#spliterator(long[], int, int)} can
|
||||
* often be used instead, which returns a spliterator that reports
|
||||
* {@code SIZED}, {@code SUBSIZED}, {@code IMMUTABLE}, and {@code ORDERED}.
|
||||
@ -358,7 +358,7 @@ public final class Spliterators {
|
||||
* @param toIndex One past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
* @return A spliterator for an array
|
||||
* @throws NullPointerException if the given array is {@code null}
|
||||
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
|
||||
@ -907,7 +907,7 @@ public final class Spliterators {
|
||||
* @param array the array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public ArraySpliterator(Object[] array, int additionalCharacteristics) {
|
||||
this(array, 0, array.length, additionalCharacteristics);
|
||||
@ -920,7 +920,7 @@ public final class Spliterators {
|
||||
* @param fence one past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public ArraySpliterator(Object[] array, int origin, int fence, int additionalCharacteristics) {
|
||||
this.array = array;
|
||||
@ -992,7 +992,7 @@ public final class Spliterators {
|
||||
* @param array the array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public IntArraySpliterator(int[] array, int additionalCharacteristics) {
|
||||
this(array, 0, array.length, additionalCharacteristics);
|
||||
@ -1005,7 +1005,7 @@ public final class Spliterators {
|
||||
* @param fence one past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public IntArraySpliterator(int[] array, int origin, int fence, int additionalCharacteristics) {
|
||||
this.array = array;
|
||||
@ -1075,7 +1075,7 @@ public final class Spliterators {
|
||||
* @param array the array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public LongArraySpliterator(long[] array, int additionalCharacteristics) {
|
||||
this(array, 0, array.length, additionalCharacteristics);
|
||||
@ -1088,7 +1088,7 @@ public final class Spliterators {
|
||||
* @param fence one past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public LongArraySpliterator(long[] array, int origin, int fence, int additionalCharacteristics) {
|
||||
this.array = array;
|
||||
@ -1158,7 +1158,7 @@ public final class Spliterators {
|
||||
* @param array the array, assumed to be unmodified during use
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public DoubleArraySpliterator(double[] array, int additionalCharacteristics) {
|
||||
this(array, 0, array.length, additionalCharacteristics);
|
||||
@ -1171,7 +1171,7 @@ public final class Spliterators {
|
||||
* @param fence one past the greatest index to cover
|
||||
* @param additionalCharacteristics Additional spliterator characteristics
|
||||
* of this spliterator's source or elements beyond {@code SIZED} and
|
||||
* {@code SUBSIZED} which are are always reported
|
||||
* {@code SUBSIZED} which are always reported
|
||||
*/
|
||||
public DoubleArraySpliterator(double[] array, int origin, int fence, int additionalCharacteristics) {
|
||||
this.array = array;
|
||||
@ -1698,7 +1698,7 @@ public final class Spliterators {
|
||||
private int batch; // batch size for splits
|
||||
|
||||
/**
|
||||
* Creates a spliterator using the given given
|
||||
* Creates a spliterator using the given
|
||||
* collection's {@link java.util.Collection#iterator()) for traversal,
|
||||
* and reporting its {@link java.util.Collection#size()) as its initial
|
||||
* size.
|
||||
|
@ -43,9 +43,8 @@ import java.util.Locale;
|
||||
* supported by the Java runtime environment itself.
|
||||
*
|
||||
* <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
|
||||
* Implementations of these locale sensitive services are packaged using the
|
||||
* <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
|
||||
* as installed extensions. A provider identifies itself with a
|
||||
* Implementations of these locale sensitive services can be made available
|
||||
* by adding them to the application's class path. A provider identifies itself with a
|
||||
* provider-configuration file in the resource directory META-INF/services,
|
||||
* using the fully qualified provider interface class name as the file name.
|
||||
* The file should contain a list of fully-qualified concrete provider class names,
|
||||
|
@ -204,7 +204,6 @@ public final class CRC32C implements Checksum {
|
||||
/**
|
||||
* Updates the CRC-32C checksum with the specified array of bytes.
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Unsafe.{getInt, getLong}
|
||||
private static int updateBytes(int crc, byte[] b, int off, int end) {
|
||||
|
||||
// Do only byte reads for arrays so short they can't be aligned
|
||||
@ -228,11 +227,11 @@ public final class CRC32C implements Checksum {
|
||||
int secondHalf;
|
||||
if (Unsafe.ADDRESS_SIZE == 4) {
|
||||
// On 32 bit platforms read two ints instead of a single 64bit long
|
||||
firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||
secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
|
||||
firstHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||
secondHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off
|
||||
+ Integer.BYTES);
|
||||
} else {
|
||||
long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||
long value = UNSAFE.getLong(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
|
||||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
|
||||
firstHalf = (int) value;
|
||||
secondHalf = (int) (value >>> 32);
|
||||
|
@ -76,7 +76,7 @@ import sun.security.util.Debug;
|
||||
* </pre>
|
||||
*
|
||||
* The CodeBase and Signedby components of the triplet name/value pairs
|
||||
* are optional. If they are not present, then any any codebase will match,
|
||||
* are optional. If they are not present, then any codebase will match,
|
||||
* and any signer (including unsigned code) will match.
|
||||
* For Example,
|
||||
*
|
||||
|
@ -137,7 +137,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
|
||||
* @param currentDomains the ProtectionDomains associated with the
|
||||
* current execution Thread, up to the most recent
|
||||
* privileged {@code ProtectionDomain}.
|
||||
* The ProtectionDomains are are listed in order of execution,
|
||||
* The ProtectionDomains are listed in order of execution,
|
||||
* with the most recently executing {@code ProtectionDomain}
|
||||
* residing at the beginning of the array. This parameter may
|
||||
* be {@code null} if the current execution Thread
|
||||
|
@ -192,7 +192,7 @@ final class Frame {
|
||||
private static final int LOCAL = 0x2000000;
|
||||
|
||||
/**
|
||||
* Kind of the the types that are relative to the stack of an input stack
|
||||
* Kind of the types that are relative to the stack of an input stack
|
||||
* map frame. The value of such types is a position relatively to the top of
|
||||
* this stack.
|
||||
*/
|
||||
|
@ -116,7 +116,7 @@ public interface XMLStreamWriter {
|
||||
public void writeStartDocument() throws XMLStreamException;
|
||||
|
||||
/**
|
||||
* Write the XML Declaration. Defaults the the encoding to utf-8
|
||||
* Write the XML Declaration. Defaults the encoding to utf-8
|
||||
* @param version version of the xml document
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
|
@ -80,7 +80,7 @@ public class VerifyAccess {
|
||||
* @param defc the class in which the proposed member is actually defined
|
||||
* @param mods modifier flags for the proposed member
|
||||
* @param lookupClass the class for which the access check is being made
|
||||
* @return true iff the the accessing class can access such a member
|
||||
* @return true iff the accessing class can access such a member
|
||||
*/
|
||||
public static boolean isMemberAccessible(Class<?> refc, // symbolic ref class
|
||||
Class<?> defc, // actual def class
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2007, 2014, 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
|
||||
@ -46,11 +46,7 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
|
||||
\ -verbose:[class|gc|jni]\n\
|
||||
\ enable verbose output\n\
|
||||
\ -version print product version and exit\n\
|
||||
\ -version:<value>\n\
|
||||
\ require the specified version to run\n\
|
||||
\ -showversion print product version and continue\n\
|
||||
\ -jre-restrict-search | -no-jre-restrict-search\n\
|
||||
\ include/exclude user private JREs in the version search\n\
|
||||
\ -? -help print this help message\n\
|
||||
\ -X print help on non-standard options\n\
|
||||
\ -ea[:<packagename>...|:<classname>]\n\
|
||||
|
@ -42,7 +42,7 @@ public interface JavaNioAccess {
|
||||
|
||||
/**
|
||||
* Constructs a direct ByteBuffer referring to the block of memory starting
|
||||
* at the given memory address and and extending {@code cap} bytes.
|
||||
* at the given memory address and extending {@code cap} bytes.
|
||||
* The {@code ob} parameter is an arbitrary object that is attached
|
||||
* to the resulting buffer.
|
||||
*/
|
||||
|
@ -958,6 +958,8 @@ public final class Unsafe {
|
||||
* other threads. This method is generally only useful if the
|
||||
* underlying field is a Java volatile (or if an array cell, one
|
||||
* that is otherwise only accessed using volatile accesses).
|
||||
*
|
||||
* Corresponds to C11 atomic_store_explicit(..., memory_order_release).
|
||||
*/
|
||||
public native void putOrderedObject(Object o, long offset, Object x);
|
||||
|
||||
@ -1111,22 +1113,40 @@ public final class Unsafe {
|
||||
|
||||
|
||||
/**
|
||||
* Ensures lack of reordering of loads before the fence
|
||||
* with loads or stores after the fence.
|
||||
* Ensures that loads before the fence will not be reordered with loads and
|
||||
* stores after the fence; a "LoadLoad plus LoadStore barrier".
|
||||
*
|
||||
* Corresponds to C11 atomic_thread_fence(memory_order_acquire)
|
||||
* (an "acquire fence").
|
||||
*
|
||||
* A pure LoadLoad fence is not provided, since the addition of LoadStore
|
||||
* is almost always desired, and most current hardware instructions that
|
||||
* provide a LoadLoad barrier also provide a LoadStore barrier for free.
|
||||
* @since 1.8
|
||||
*/
|
||||
public native void loadFence();
|
||||
|
||||
/**
|
||||
* Ensures lack of reordering of stores before the fence
|
||||
* with loads or stores after the fence.
|
||||
* Ensures that loads and stores before the fence will not be reordered with
|
||||
* stores after the fence; a "StoreStore plus LoadStore barrier".
|
||||
*
|
||||
* Corresponds to C11 atomic_thread_fence(memory_order_release)
|
||||
* (a "release fence").
|
||||
*
|
||||
* A pure StoreStore fence is not provided, since the addition of LoadStore
|
||||
* is almost always desired, and most current hardware instructions that
|
||||
* provide a StoreStore barrier also provide a LoadStore barrier for free.
|
||||
* @since 1.8
|
||||
*/
|
||||
public native void storeFence();
|
||||
|
||||
/**
|
||||
* Ensures lack of reordering of loads or stores before the fence
|
||||
* with loads or stores after the fence.
|
||||
* Ensures that loads and stores before the fence will not be reordered
|
||||
* with loads and stores after the fence. Implies the effects of both
|
||||
* loadFence() and storeFence(), and in addition, the effect of a StoreLoad
|
||||
* barrier.
|
||||
*
|
||||
* Corresponds to C11 atomic_thread_fence(memory_order_seq_cst).
|
||||
* @since 1.8
|
||||
*/
|
||||
public native void fullFence();
|
||||
|
@ -150,7 +150,7 @@ public class VM {
|
||||
private static volatile boolean booted = false;
|
||||
private static final Object lock = new Object();
|
||||
|
||||
// Invoked by by System.initializeSystemClass just before returning.
|
||||
// Invoked by System.initializeSystemClass just before returning.
|
||||
// Subsystems that are invoked during initialization can check this
|
||||
// property in order to avoid doing things that should wait until the
|
||||
// application class loader has been set up.
|
||||
|
@ -2187,7 +2187,7 @@ public class FtpClient extends sun.net.ftp.FtpClient {
|
||||
return resp.get(0).substring(4);
|
||||
}
|
||||
// on multiple lines answers, like the ones above, remove 1st and last
|
||||
// line, concat the the others.
|
||||
// line, concat the others.
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 1; i < resp.size() - 1; i++) {
|
||||
sb.append(resp.get(i).substring(3));
|
||||
|
@ -110,6 +110,9 @@ public class FileChannelImpl
|
||||
// -- Standard channel operations --
|
||||
|
||||
protected void implCloseChannel() throws IOException {
|
||||
if (!fd.valid())
|
||||
return; // nothing to do
|
||||
|
||||
// Release and invalidate any locks that we still hold
|
||||
if (fileLockTable != null) {
|
||||
for (FileLock fl: fileLockTable.removeAll()) {
|
||||
|
@ -52,7 +52,7 @@ class Label {
|
||||
final short patchBCI;
|
||||
final int stackDepth;
|
||||
}
|
||||
private List<PatchInfo> patches = new ArrayList<>();
|
||||
private final List<PatchInfo> patches = new ArrayList<>();
|
||||
|
||||
public Label() {
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class ReflectionFactory {
|
||||
* be initialized and therefore must not be called until the
|
||||
* first get/set of this field.
|
||||
* @param field the field
|
||||
* @param override true if caller has overridden aaccessibility
|
||||
* @param override true if caller has overridden accessibility
|
||||
*/
|
||||
public FieldAccessor newFieldAccessor(Field field, boolean override) {
|
||||
checkInitted();
|
||||
|
@ -280,19 +280,25 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
||||
* be rare).
|
||||
*/
|
||||
private Method[] getMemberMethods() {
|
||||
if (memberMethods == null) {
|
||||
memberMethods = AccessController.doPrivileged(
|
||||
new PrivilegedAction<Method[]>() {
|
||||
public Method[] run() {
|
||||
final Method[] mm = type.getDeclaredMethods();
|
||||
validateAnnotationMethods(mm);
|
||||
AccessibleObject.setAccessible(mm, true);
|
||||
return mm;
|
||||
}
|
||||
});
|
||||
Method[] value = memberMethods;
|
||||
if (value == null) {
|
||||
value = computeMemberMethods();
|
||||
memberMethods = value;
|
||||
}
|
||||
return memberMethods;
|
||||
return value;
|
||||
}
|
||||
|
||||
private Method[] computeMemberMethods() {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<Method[]>() {
|
||||
public Method[] run() {
|
||||
final Method[] methods = type.getDeclaredMethods();
|
||||
validateAnnotationMethods(methods);
|
||||
AccessibleObject.setAccessible(methods, true);
|
||||
return methods;
|
||||
}});
|
||||
}
|
||||
|
||||
private transient volatile Method[] memberMethods = null;
|
||||
|
||||
/**
|
||||
|
@ -772,7 +772,7 @@ public class AnnotationParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an appropriate exception proxy for a mismatching array
|
||||
* Returns an appropriate exception proxy for a mismatching array
|
||||
* annotation where the erroneous array has the specified tag.
|
||||
*/
|
||||
private static ExceptionProxy exceptionProxy(int tag) {
|
||||
|
@ -115,7 +115,7 @@ public final class AnnotationSupport {
|
||||
|
||||
|
||||
/**
|
||||
* Figures out if conatiner class comes before containee class among the
|
||||
* Figures out if container class comes before containee class among the
|
||||
* keys of the given map.
|
||||
*
|
||||
* @return true if container class is found before containee class when
|
||||
|
@ -55,7 +55,7 @@ public class AnnotationType {
|
||||
private final Map<String, Object> memberDefaults;
|
||||
|
||||
/**
|
||||
* Member name -> Method object mapping. This (and its assoicated
|
||||
* Member name -> Method object mapping. This (and its associated
|
||||
* accessor) are used only to generate AnnotationTypeMismatchExceptions.
|
||||
*/
|
||||
private final Map<String, Method> members;
|
||||
@ -117,7 +117,7 @@ public class AnnotationType {
|
||||
memberDefaults = new HashMap<String, Object>(0);
|
||||
members = new HashMap<String, Method>(methods.length+1, 1.0f);
|
||||
|
||||
for (Method method : methods) {
|
||||
for (Method method : methods) {
|
||||
if (method.getParameterTypes().length != 0)
|
||||
throw new IllegalArgumentException(method + " has params");
|
||||
String name = method.getName();
|
||||
@ -213,7 +213,7 @@ public class AnnotationType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this this annotation type is inherited.
|
||||
* Returns true if this annotation type is inherited.
|
||||
*/
|
||||
public boolean isInherited() {
|
||||
return inherited;
|
||||
|
@ -36,7 +36,7 @@ import java.lang.reflect.Method;
|
||||
class AnnotationTypeMismatchExceptionProxy extends ExceptionProxy {
|
||||
private static final long serialVersionUID = 7844069490309503934L;
|
||||
private Method member;
|
||||
private String foundType;
|
||||
private final String foundType;
|
||||
|
||||
/**
|
||||
* It turns out to be convenient to construct these proxies in
|
||||
|
@ -33,8 +33,8 @@ package sun.reflect.annotation;
|
||||
*/
|
||||
public class EnumConstantNotPresentExceptionProxy extends ExceptionProxy {
|
||||
private static final long serialVersionUID = -604662101303187330L;
|
||||
Class<? extends Enum<?>> enumType;
|
||||
String constName;
|
||||
final Class<? extends Enum<?>> enumType;
|
||||
final String constName;
|
||||
|
||||
public EnumConstantNotPresentExceptionProxy(Class<? extends Enum<?>> enumType,
|
||||
String constName) {
|
||||
|
@ -34,8 +34,8 @@ import java.lang.annotation.*;
|
||||
*/
|
||||
public class TypeNotPresentExceptionProxy extends ExceptionProxy {
|
||||
private static final long serialVersionUID = 5565925172427947573L;
|
||||
String typeName;
|
||||
Throwable cause;
|
||||
final String typeName;
|
||||
final Throwable cause;
|
||||
|
||||
public TypeNotPresentExceptionProxy(String typeName, Throwable cause) {
|
||||
this.typeName = typeName;
|
||||
|
@ -76,11 +76,11 @@ public class CoreReflectionFactory implements GenericsFactory {
|
||||
* kind. Classes produced will be those that would be loaded by the
|
||||
* defining class loader of the declaration <tt>d</tt> (if <tt>d</tt>
|
||||
* is a type declaration, or by the defining loader of the declaring
|
||||
* class of <tt>d</tt> otherwise.
|
||||
* class of <tt>d</tt> otherwise.
|
||||
* <p> Type variables will be created or lookup as necessary in the
|
||||
* scope <tt> s</tt>.
|
||||
* @param d - the generic declaration (class, interface, method or
|
||||
* constructor) that thsi factory services
|
||||
* constructor) that this factory services
|
||||
* @param s the scope in which the factory will allocate and search for
|
||||
* type variables
|
||||
* @return an instance of <tt>CoreReflectionFactory</tt>
|
||||
|
@ -42,7 +42,7 @@ import sun.reflect.generics.tree.FieldTypeSignature;
|
||||
* of a specific implementation by using this interface. For example,
|
||||
* repositories of generic type information are initialized with a
|
||||
* factory conforming to this interface, and use it to generate the
|
||||
* tpe information they are required to provide. As a result, such
|
||||
* type information they are required to provide. As a result, such
|
||||
* repository code can be shared across different reflective systems.
|
||||
*/
|
||||
public interface GenericsFactory {
|
||||
@ -60,7 +60,7 @@ public interface GenericsFactory {
|
||||
TypeVariable<?> makeTypeVariable(String name,
|
||||
FieldTypeSignature[] bounds);
|
||||
/**
|
||||
* Return an instance of the <tt>ParameterizedType</tt> interface
|
||||
* Returns an instance of the <tt>ParameterizedType</tt> interface
|
||||
* that corresponds to a generic type instantiation of the
|
||||
* generic declaration <tt>declaration</tt> with actual type arguments
|
||||
* <tt>typeArgs</tt>.
|
||||
@ -123,7 +123,7 @@ public interface GenericsFactory {
|
||||
/**
|
||||
* Returns a (possibly generic) array type.
|
||||
* If the component type is a parameterized type, it must
|
||||
* only have unbounded wildcard arguemnts, otherwise
|
||||
* only have unbounded wildcard arguments, otherwise
|
||||
* a MalformedParameterizedTypeException is thrown.
|
||||
* @param componentType - the component type of the array
|
||||
* @return a (possibly generic) array type.
|
||||
|
@ -227,7 +227,7 @@ public class SignatureParser {
|
||||
* "<" FormalTypeParameter+ ">"
|
||||
*/
|
||||
private FormalTypeParameter[] parseFormalTypeParameters(){
|
||||
List<FormalTypeParameter> ftps = new ArrayList<>(3);
|
||||
List<FormalTypeParameter> ftps = new ArrayList<>(3);
|
||||
assert(current() == '<'); // should not have been called at all
|
||||
if (current() != '<') { throw error("expected '<'");}
|
||||
advance();
|
||||
|
@ -53,10 +53,10 @@ public class GenericArrayTypeImpl
|
||||
|
||||
|
||||
/**
|
||||
* Returns a <tt>Type</tt> object representing the component type
|
||||
* Returns a <tt>Type</tt> object representing the component type
|
||||
* of this array.
|
||||
*
|
||||
* @return a <tt>Type</tt> object representing the component type
|
||||
* @return a <tt>Type</tt> object representing the component type
|
||||
* of this array
|
||||
* @since 1.5
|
||||
*/
|
||||
|
@ -25,7 +25,9 @@
|
||||
|
||||
package sun.reflect.generics.reflectiveObjects;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import sun.reflect.generics.factory.GenericsFactory;
|
||||
import sun.reflect.generics.tree.FieldTypeSignature;
|
||||
import sun.reflect.generics.visitor.Reifier;
|
||||
|
||||
|
||||
@ -54,4 +56,16 @@ public abstract class LazyReflectiveObjectGenerator {
|
||||
// produce a reifying visitor (could this be typed as a TypeTreeVisitor?
|
||||
protected Reifier getReifier(){return Reifier.make(getFactory());}
|
||||
|
||||
Type[] reifyBounds(FieldTypeSignature[] boundASTs) {
|
||||
final int length = boundASTs.length;
|
||||
final Type[] bounds = new Type[length];
|
||||
// iterate over bound trees, reifying each in turn
|
||||
for (int i = 0; i < length; i++) {
|
||||
Reifier r = getReifier();
|
||||
boundASTs[i].accept(r);
|
||||
bounds[i] = r.getResult();
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,17 +51,16 @@ import sun.reflect.misc.ReflectUtil;
|
||||
*/
|
||||
public class TypeVariableImpl<D extends GenericDeclaration>
|
||||
extends LazyReflectiveObjectGenerator implements TypeVariable<D> {
|
||||
D genericDeclaration;
|
||||
private String name;
|
||||
// upper bounds - evaluated lazily
|
||||
private Type[] bounds;
|
||||
private final D genericDeclaration;
|
||||
private final String name;
|
||||
|
||||
// The ASTs for the bounds. We are required to evaluate the bounds
|
||||
// lazily, so we store these at least until we are first asked
|
||||
// for the bounds. This also neatly solves the
|
||||
// problem with F-bounds - you can't reify them before the formal
|
||||
// is defined.
|
||||
private FieldTypeSignature[] boundASTs;
|
||||
/**
|
||||
* The upper bounds. Lazily converted from FieldTypeSignature[] to Type[].
|
||||
* We are required to evaluate the bounds lazily, so we store them as ASTs
|
||||
* until we are first asked for them. This also neatly solves the problem
|
||||
* with F-bounds - you can't reify them before the formal is defined.
|
||||
*/
|
||||
private volatile Object[] bounds;
|
||||
|
||||
// constructor is private to enforce access through static factory
|
||||
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
|
||||
@ -69,18 +68,7 @@ public class TypeVariableImpl<D extends GenericDeclaration>
|
||||
super(f);
|
||||
genericDeclaration = decl;
|
||||
name = n;
|
||||
boundASTs = bs;
|
||||
}
|
||||
|
||||
// Accessors
|
||||
|
||||
// accessor for ASTs for bounds. Must not be called after
|
||||
// bounds have been evaluated, because we might throw the ASTs
|
||||
// away (but that is not thread-safe, is it?)
|
||||
private FieldTypeSignature[] getBoundASTs() {
|
||||
// check that bounds were not evaluated yet
|
||||
assert(bounds == null);
|
||||
return boundASTs;
|
||||
bounds = bs;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +111,7 @@ public class TypeVariableImpl<D extends GenericDeclaration>
|
||||
* <li>Otherwise, B is resolved.
|
||||
* </ul>
|
||||
*
|
||||
* @throws <tt>TypeNotPresentException</tt> if any of the
|
||||
* @throws <tt>TypeNotPresentException</tt> if any of the
|
||||
* bounds refers to a non-existent type declaration
|
||||
* @throws <tt>MalformedParameterizedTypeException</tt> if any of the
|
||||
* bounds refer to a parameterized type that cannot be instantiated
|
||||
@ -132,34 +120,23 @@ public class TypeVariableImpl<D extends GenericDeclaration>
|
||||
* type variable
|
||||
*/
|
||||
public Type[] getBounds() {
|
||||
// lazily initialize bounds if necessary
|
||||
if (bounds == null) {
|
||||
FieldTypeSignature[] fts = getBoundASTs(); // get AST
|
||||
// allocate result array; note that
|
||||
// keeping ts and bounds separate helps with threads
|
||||
Type[] ts = new Type[fts.length];
|
||||
// iterate over bound trees, reifying each in turn
|
||||
for ( int j = 0; j < fts.length; j++) {
|
||||
Reifier r = getReifier();
|
||||
fts[j].accept(r);
|
||||
ts[j] = r.getResult();
|
||||
}
|
||||
// cache result
|
||||
bounds = ts;
|
||||
// could throw away bound ASTs here; thread safety?
|
||||
Object[] value = bounds;
|
||||
if (value instanceof FieldTypeSignature[]) {
|
||||
value = reifyBounds((FieldTypeSignature[])value);
|
||||
bounds = value;
|
||||
}
|
||||
return bounds.clone(); // return cached bounds
|
||||
return (Type[])value.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <tt>GenericDeclaration</tt> object representing the
|
||||
* Returns the <tt>GenericDeclaration</tt> object representing the
|
||||
* generic declaration that declared this type variable.
|
||||
*
|
||||
* @return the generic declaration that declared this type variable.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public D getGenericDeclaration(){
|
||||
public D getGenericDeclaration() {
|
||||
if (genericDeclaration instanceof Class)
|
||||
ReflectUtil.checkPackageAccess((Class)genericDeclaration);
|
||||
else if ((genericDeclaration instanceof Method) ||
|
||||
|
@ -39,25 +39,26 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
|
||||
implements WildcardType {
|
||||
// upper bounds - evaluated lazily
|
||||
private Type[] upperBounds;
|
||||
// lower bounds - evaluated lazily
|
||||
private Type[] lowerBounds;
|
||||
// The ASTs for the bounds. We are required to evaluate the bounds
|
||||
// lazily, so we store these at least until we are first asked
|
||||
// for the bounds. This also neatly solves the
|
||||
// problem with F-bounds - you can't reify them before the formal
|
||||
// is defined.
|
||||
private FieldTypeSignature[] upperBoundASTs;
|
||||
private FieldTypeSignature[] lowerBoundASTs;
|
||||
|
||||
/*
|
||||
* We are required to evaluate the bounds lazily, so we store them as ASTs
|
||||
* until we are first asked for them. This also neatly solves the problem
|
||||
* with F-bounds - you can't reify them before the formal is defined.
|
||||
*/
|
||||
|
||||
/** The upper bounds. Lazily converted from FieldTypeSignature[] to Type[]. */
|
||||
private volatile Object[] upperBounds;
|
||||
|
||||
/** The lower bounds. Lazily converted from FieldTypeSignature[] to Type[]. */
|
||||
private volatile Object[] lowerBounds;
|
||||
|
||||
// constructor is private to enforce access through static factory
|
||||
private WildcardTypeImpl(FieldTypeSignature[] ubs,
|
||||
FieldTypeSignature[] lbs,
|
||||
GenericsFactory f) {
|
||||
super(f);
|
||||
upperBoundASTs = ubs;
|
||||
lowerBoundASTs = lbs;
|
||||
upperBounds = ubs;
|
||||
lowerBounds = lbs;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,27 +77,8 @@ public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
|
||||
return new WildcardTypeImpl(ubs, lbs, f);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
|
||||
// accessor for ASTs for upper bounds. Must not be called after upper
|
||||
// bounds have been evaluated, because we might throw the ASTs
|
||||
// away (but that is not thread-safe, is it?)
|
||||
private FieldTypeSignature[] getUpperBoundASTs() {
|
||||
// check that upper bounds were not evaluated yet
|
||||
assert(upperBounds == null);
|
||||
return upperBoundASTs;
|
||||
}
|
||||
// accessor for ASTs for lower bounds. Must not be called after lower
|
||||
// bounds have been evaluated, because we might throw the ASTs
|
||||
// away (but that is not thread-safe, is it?)
|
||||
private FieldTypeSignature[] getLowerBoundASTs() {
|
||||
// check that lower bounds were not evaluated yet
|
||||
assert(lowerBounds == null);
|
||||
return lowerBoundASTs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of <tt>Type</tt> objects representing the upper
|
||||
* Returns an array of <tt>Type</tt> objects representing the upper
|
||||
* bound(s) of this type variable. Note that if no upper bound is
|
||||
* explicitly declared, the upper bound is <tt>Object</tt>.
|
||||
*
|
||||
@ -117,24 +99,12 @@ public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
|
||||
* for any reason
|
||||
*/
|
||||
public Type[] getUpperBounds() {
|
||||
// lazily initialize bounds if necessary
|
||||
if (upperBounds == null) {
|
||||
FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST
|
||||
|
||||
// allocate result array; note that
|
||||
// keeping ts and bounds separate helps with threads
|
||||
Type[] ts = new Type[fts.length];
|
||||
// iterate over bound trees, reifying each in turn
|
||||
for ( int j = 0; j < fts.length; j++) {
|
||||
Reifier r = getReifier();
|
||||
fts[j].accept(r);
|
||||
ts[j] = r.getResult();
|
||||
}
|
||||
// cache result
|
||||
upperBounds = ts;
|
||||
// could throw away upper bound ASTs here; thread safety?
|
||||
Object[] value = upperBounds;
|
||||
if (value instanceof FieldTypeSignature[]) {
|
||||
value = reifyBounds((FieldTypeSignature[])value);
|
||||
upperBounds = value;
|
||||
}
|
||||
return upperBounds.clone(); // return cached bounds
|
||||
return (Type[])value.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,23 +130,12 @@ public class WildcardTypeImpl extends LazyReflectiveObjectGenerator
|
||||
* for any reason
|
||||
*/
|
||||
public Type[] getLowerBounds() {
|
||||
// lazily initialize bounds if necessary
|
||||
if (lowerBounds == null) {
|
||||
FieldTypeSignature[] fts = getLowerBoundASTs(); // get AST
|
||||
// allocate result array; note that
|
||||
// keeping ts and bounds separate helps with threads
|
||||
Type[] ts = new Type[fts.length];
|
||||
// iterate over bound trees, reifying each in turn
|
||||
for ( int j = 0; j < fts.length; j++) {
|
||||
Reifier r = getReifier();
|
||||
fts[j].accept(r);
|
||||
ts[j] = r.getResult();
|
||||
}
|
||||
// cache result
|
||||
lowerBounds = ts;
|
||||
// could throw away lower bound ASTs here; thread safety?
|
||||
Object[] value = lowerBounds;
|
||||
if (value instanceof FieldTypeSignature[]) {
|
||||
value = reifyBounds((FieldTypeSignature[])value);
|
||||
lowerBounds = value;
|
||||
}
|
||||
return lowerBounds.clone(); // return cached bounds
|
||||
return (Type[])value.clone();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -56,7 +56,7 @@ public abstract class AbstractRepository<T extends Tree> {
|
||||
/**
|
||||
* Returns a <tt>Reifier</tt> used to convert parts of the
|
||||
* AST into reflective objects.
|
||||
* @return a <tt>Reifier</tt> used to convert parts of the
|
||||
* @return a <tt>Reifier</tt> used to convert parts of the
|
||||
* AST into reflective objects
|
||||
*/
|
||||
protected Reifier getReifier(){return Reifier.make(getFactory());}
|
||||
@ -76,7 +76,7 @@ public abstract class AbstractRepository<T extends Tree> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the AST for the genric type info of this entity.
|
||||
* Returns the AST for the generic type info of this entity.
|
||||
* @param s - a string representing the generic signature of this
|
||||
* entity
|
||||
* @return the AST for the generic type info of this entity.
|
||||
|
@ -25,12 +25,12 @@
|
||||
|
||||
package sun.reflect.generics.repository;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import sun.reflect.generics.factory.GenericsFactory;
|
||||
import sun.reflect.generics.tree.ClassSignature;
|
||||
import sun.reflect.generics.tree.TypeTree;
|
||||
import sun.reflect.generics.visitor.Reifier;
|
||||
import sun.reflect.generics.parser.SignatureParser;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
|
||||
/**
|
||||
@ -70,47 +70,54 @@ public class ClassRepository extends GenericDeclRepository<ClassSignature> {
|
||||
return new ClassRepository(rawSig, f);
|
||||
}
|
||||
|
||||
// public API
|
||||
/*
|
||||
* When queried for a particular piece of type information, the
|
||||
* general pattern is to consult the corresponding cached value.
|
||||
* If the corresponding field is non-null, it is returned.
|
||||
* If not, it is created lazily. This is done by selecting the appropriate
|
||||
* part of the tree and transforming it into a reflective object
|
||||
* using a visitor.
|
||||
* a visitor, which is created by feeding it the factory
|
||||
* using a visitor, which is created by feeding it the factory
|
||||
* with which the repository was created.
|
||||
*/
|
||||
|
||||
public Type getSuperclass() {
|
||||
Type superclass = this.superclass;
|
||||
if (superclass == null) { // lazily initialize superclass
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
// Extract superclass subtree from AST and reify
|
||||
getTree().getSuperclass().accept(r);
|
||||
// extract result from visitor and cache it
|
||||
superclass = r.getResult();
|
||||
this.superclass = superclass;
|
||||
Type value = superclass;
|
||||
if (value == null) {
|
||||
value = computeSuperclass();
|
||||
superclass = value;
|
||||
}
|
||||
return superclass; // return cached result
|
||||
return value;
|
||||
}
|
||||
|
||||
public Type[] getSuperInterfaces() {
|
||||
Type[] superInterfaces = this.superInterfaces;
|
||||
if (superInterfaces == null) { // lazily initialize super interfaces
|
||||
// first, extract super interface subtree(s) from AST
|
||||
TypeTree[] ts = getTree().getSuperInterfaces();
|
||||
// create array to store reified subtree(s)
|
||||
superInterfaces = new Type[ts.length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < ts.length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ts[i].accept(r);// reify subtree
|
||||
// extract result from visitor and store it
|
||||
superInterfaces[i] = r.getResult();
|
||||
}
|
||||
this.superInterfaces = superInterfaces;
|
||||
Type[] value = superInterfaces;
|
||||
if (value == null) {
|
||||
value = computeSuperInterfaces();
|
||||
superInterfaces = value;
|
||||
}
|
||||
return superInterfaces.clone(); // return cached result
|
||||
return value.clone();
|
||||
}
|
||||
|
||||
private Type computeSuperclass() {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
// Extract superclass subtree from AST and reify
|
||||
getTree().getSuperclass().accept(r);
|
||||
return r.getResult();
|
||||
}
|
||||
|
||||
private Type[] computeSuperInterfaces() {
|
||||
// first, extract super interface subtree(s) from AST
|
||||
TypeTree[] ts = getTree().getSuperInterfaces();
|
||||
// create array to store reified subtree(s)
|
||||
int length = ts.length;
|
||||
Type[] superInterfaces = new Type[length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ts[i].accept(r);// reify subtree
|
||||
// extract result from visitor and store it
|
||||
superInterfaces[i] = r.getResult();
|
||||
}
|
||||
return superInterfaces;
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,11 @@ import sun.reflect.generics.visitor.Reifier;
|
||||
public class ConstructorRepository
|
||||
extends GenericDeclRepository<MethodTypeSignature> {
|
||||
|
||||
private Type[] paramTypes; // caches the generic parameter types info
|
||||
private Type[] exceptionTypes; // caches the generic exception types info
|
||||
/** The generic parameter types. Lazily initialized. */
|
||||
private volatile Type[] parameterTypes;
|
||||
|
||||
/** The generic exception types. Lazily initialized. */
|
||||
private volatile Type[] exceptionTypes;
|
||||
|
||||
// protected, to enforce use of static factory yet allow subclassing
|
||||
protected ConstructorRepository(String rawSig, GenericsFactory f) {
|
||||
@ -64,57 +67,67 @@ public class ConstructorRepository
|
||||
* @return a <tt>ConstructorRepository</tt> that manages the generic type
|
||||
* information represented in the signature <tt>rawSig</tt>
|
||||
*/
|
||||
public static ConstructorRepository make(String rawSig,
|
||||
GenericsFactory f) {
|
||||
public static ConstructorRepository make(String rawSig, GenericsFactory f) {
|
||||
return new ConstructorRepository(rawSig, f);
|
||||
}
|
||||
|
||||
// public API
|
||||
|
||||
/*
|
||||
* When queried for a particular piece of type information, the
|
||||
* general pattern is to consult the corresponding cached value.
|
||||
* If the corresponding field is non-null, it is returned.
|
||||
* If not, it is created lazily. This is done by selecting the appropriate
|
||||
* part of the tree and transforming it into a reflective object
|
||||
* using a visitor.
|
||||
* a visitor, which is created by feeding it the factory
|
||||
* using a visitor, which is created by feeding it the factory
|
||||
* with which the repository was created.
|
||||
*/
|
||||
|
||||
public Type[] getParameterTypes(){
|
||||
if (paramTypes == null) { // lazily initialize parameter types
|
||||
// first, extract parameter type subtree(s) from AST
|
||||
TypeSignature[] pts = getTree().getParameterTypes();
|
||||
// create array to store reified subtree(s)
|
||||
Type[] ps = new Type[pts.length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < pts.length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
pts[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
ps[i] = r.getResult();
|
||||
}
|
||||
paramTypes = ps; // cache overall result
|
||||
public Type[] getParameterTypes() {
|
||||
Type[] value = parameterTypes;
|
||||
if (value == null) {
|
||||
value = computeParameterTypes();
|
||||
parameterTypes = value;
|
||||
}
|
||||
return paramTypes.clone(); // return cached result
|
||||
return value.clone();
|
||||
}
|
||||
|
||||
public Type[] getExceptionTypes(){
|
||||
if (exceptionTypes == null) { // lazily initialize exception types
|
||||
// first, extract exception type subtree(s) from AST
|
||||
FieldTypeSignature[] ets = getTree().getExceptionTypes();
|
||||
// create array to store reified subtree(s)
|
||||
Type[] es = new Type[ets.length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < ets.length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ets[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
es[i] = r.getResult();
|
||||
}
|
||||
exceptionTypes = es; // cache overall result
|
||||
public Type[] getExceptionTypes() {
|
||||
Type[] value = exceptionTypes;
|
||||
if (value == null) {
|
||||
value = computeExceptionTypes();
|
||||
exceptionTypes = value;
|
||||
}
|
||||
return exceptionTypes.clone(); // return cached result
|
||||
return value.clone();
|
||||
}
|
||||
|
||||
private Type[] computeParameterTypes() {
|
||||
// first, extract parameter type subtree(s) from AST
|
||||
TypeSignature[] pts = getTree().getParameterTypes();
|
||||
// create array to store reified subtree(s)
|
||||
int length = pts.length;
|
||||
Type[] parameterTypes = new Type[length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
pts[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
parameterTypes[i] = r.getResult();
|
||||
}
|
||||
return parameterTypes;
|
||||
}
|
||||
|
||||
private Type[] computeExceptionTypes() {
|
||||
// first, extract exception type subtree(s) from AST
|
||||
FieldTypeSignature[] ets = getTree().getExceptionTypes();
|
||||
// create array to store reified subtree(s)
|
||||
int length = ets.length;
|
||||
Type[] exceptionTypes = new Type[length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ets[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
exceptionTypes[i] = r.getResult();
|
||||
}
|
||||
return exceptionTypes;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ import sun.reflect.generics.visitor.Reifier;
|
||||
*/
|
||||
public class FieldRepository extends AbstractRepository<TypeSignature> {
|
||||
|
||||
private Type genericType; // caches the generic type info
|
||||
/** The generic type info. Lazily initialized. */
|
||||
private volatile Type genericType;
|
||||
|
||||
// protected, to enforce use of static factory yet allow subclassing
|
||||
protected FieldRepository(String rawSig, GenericsFactory f) {
|
||||
@ -61,31 +62,32 @@ public class FieldRepository extends AbstractRepository<TypeSignature> {
|
||||
* @return a <tt>FieldRepository</tt> that manages the generic type
|
||||
* information represented in the signature <tt>rawSig</tt>
|
||||
*/
|
||||
public static FieldRepository make(String rawSig,
|
||||
GenericsFactory f) {
|
||||
public static FieldRepository make(String rawSig, GenericsFactory f) {
|
||||
return new FieldRepository(rawSig, f);
|
||||
}
|
||||
|
||||
// public API
|
||||
|
||||
/*
|
||||
* When queried for a particular piece of type information, the
|
||||
* general pattern is to consult the corresponding cached value.
|
||||
* If the corresponding field is non-null, it is returned.
|
||||
* If not, it is created lazily. This is done by selecting the appropriate
|
||||
* part of the tree and transforming it into a reflective object
|
||||
* using a visitor.
|
||||
* a visitor, which is created by feeding it the factory
|
||||
* using a visitor, which is created by feeding it the factory
|
||||
* with which the repository was created.
|
||||
*/
|
||||
|
||||
public Type getGenericType(){
|
||||
if (genericType == null) { // lazily initialize generic type
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
getTree().accept(r); // reify subtree
|
||||
// extract result from visitor and cache it
|
||||
genericType = r.getResult();
|
||||
public Type getGenericType() {
|
||||
Type value = genericType;
|
||||
if (value == null) {
|
||||
value = computeGenericType();
|
||||
genericType = value;
|
||||
}
|
||||
return genericType; // return cached result
|
||||
return value;
|
||||
}
|
||||
|
||||
private Type computeGenericType() {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
getTree().accept(r); // reify subtree
|
||||
return r.getResult(); // extract result from visitor
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,12 @@ public abstract class GenericDeclRepository<S extends Signature>
|
||||
extends AbstractRepository<S> {
|
||||
|
||||
/** The formal type parameters. Lazily initialized. */
|
||||
private volatile TypeVariable<?>[] typeParams;
|
||||
private volatile TypeVariable<?>[] typeParameters;
|
||||
|
||||
protected GenericDeclRepository(String rawSig, GenericsFactory f) {
|
||||
super(rawSig, f);
|
||||
}
|
||||
|
||||
// public API
|
||||
/*
|
||||
* When queried for a particular piece of type information, the
|
||||
* general pattern is to consult the corresponding cached value.
|
||||
@ -61,25 +60,31 @@ public abstract class GenericDeclRepository<S extends Signature>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the formal type parameters of this generic declaration.
|
||||
* Returns the formal type parameters of this generic declaration.
|
||||
* @return the formal type parameters of this generic declaration
|
||||
*/
|
||||
public TypeVariable<?>[] getTypeParameters() {
|
||||
TypeVariable<?>[] typeParams = this.typeParams;
|
||||
if (typeParams == null) { // lazily initialize type parameters
|
||||
// first, extract type parameter subtree(s) from AST
|
||||
FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
|
||||
// create array to store reified subtree(s)
|
||||
typeParams = new TypeVariable<?>[ftps.length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < ftps.length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ftps[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
typeParams[i] = (TypeVariable<?>) r.getResult();
|
||||
}
|
||||
this.typeParams = typeParams; // cache overall result
|
||||
TypeVariable<?>[] value = typeParameters;
|
||||
if (value == null) {
|
||||
value = computeTypeParameters();
|
||||
typeParameters = value;
|
||||
}
|
||||
return typeParams.clone(); // return cached result
|
||||
return value.clone();
|
||||
}
|
||||
|
||||
private TypeVariable<?>[] computeTypeParameters() {
|
||||
// first, extract type parameter subtree(s) from AST
|
||||
FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
|
||||
// create array to store reified subtree(s)
|
||||
int length = ftps.length;
|
||||
TypeVariable<?>[] typeParameters = new TypeVariable<?>[length];
|
||||
// reify all subtrees
|
||||
for (int i = 0; i < length; i++) {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
ftps[i].accept(r); // reify subtree
|
||||
// extract result from visitor and store it
|
||||
typeParameters[i] = (TypeVariable<?>) r.getResult();
|
||||
}
|
||||
return typeParameters;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ import sun.reflect.generics.visitor.Reifier;
|
||||
*/
|
||||
public class MethodRepository extends ConstructorRepository {
|
||||
|
||||
private Type returnType; // caches the generic return type info
|
||||
/** The generic return type info. Lazily initialized. */
|
||||
private volatile Type returnType;
|
||||
|
||||
// private, to enforce use of static factory
|
||||
private MethodRepository(String rawSig, GenericsFactory f) {
|
||||
@ -59,18 +60,21 @@ public class MethodRepository extends ConstructorRepository {
|
||||
return new MethodRepository(rawSig, f);
|
||||
}
|
||||
|
||||
// public API
|
||||
|
||||
public Type getReturnType() {
|
||||
if (returnType == null) { // lazily initialize return type
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
// Extract return type subtree from AST and reify
|
||||
getTree().getReturnType().accept(r);
|
||||
// extract result from visitor and cache it
|
||||
returnType = r.getResult();
|
||||
}
|
||||
return returnType; // return cached result
|
||||
Type value = returnType;
|
||||
if (value == null) {
|
||||
value = computeReturnType();
|
||||
returnType = value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private Type computeReturnType() {
|
||||
Reifier r = getReifier(); // obtain visitor
|
||||
// Extract return type subtree from AST and reify
|
||||
getTree().getReturnType().accept(r);
|
||||
// extract result from visitor and cache it
|
||||
return r.getResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import java.lang.reflect.GenericDeclaration;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstract superclass for lazy scope objects, used when building
|
||||
* factories for generic information repositories.
|
||||
@ -49,7 +48,7 @@ public abstract class AbstractScope<D extends GenericDeclaration>
|
||||
/**
|
||||
* Constructor. Takes a reflective object whose scope the newly
|
||||
* constructed instance will represent.
|
||||
* @param D - A generic declaration whose scope the newly
|
||||
* @param decl - A generic declaration whose scope the newly
|
||||
* constructed instance will represent
|
||||
*/
|
||||
protected AbstractScope(D decl){ recvr = decl;}
|
||||
@ -63,7 +62,7 @@ public abstract class AbstractScope<D extends GenericDeclaration>
|
||||
|
||||
/** This method must be implemented by any concrete subclass.
|
||||
* It must return the enclosing scope of this scope. If this scope
|
||||
* is a top-level scope, an instance of DummyScope must be returned.
|
||||
* is a top-level scope, an instance of DummyScope must be returned.
|
||||
* @return The enclosing scope of this scope
|
||||
*/
|
||||
protected abstract Scope computeEnclosingScope();
|
||||
@ -72,13 +71,13 @@ public abstract class AbstractScope<D extends GenericDeclaration>
|
||||
* Accessor for the enclosing scope, which is computed lazily and cached.
|
||||
* @return the enclosing scope
|
||||
*/
|
||||
protected Scope getEnclosingScope(){
|
||||
Scope enclosingScope = this.enclosingScope;
|
||||
if (enclosingScope == null) {
|
||||
enclosingScope = computeEnclosingScope();
|
||||
this.enclosingScope = enclosingScope;
|
||||
protected Scope getEnclosingScope() {
|
||||
Scope value = enclosingScope;
|
||||
if (value == null) {
|
||||
value = computeEnclosingScope();
|
||||
enclosingScope = value;
|
||||
}
|
||||
return enclosingScope;
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ package sun.reflect.generics.tree;
|
||||
|
||||
/**
|
||||
* Common superinterface for generic signatures. These are the signatures
|
||||
* of complete class and method/constructor delcarations.
|
||||
* of complete class and method/constructor declarations.
|
||||
*/
|
||||
public interface Signature extends Tree{
|
||||
FormalTypeParameter[] getFormalTypeParameters();
|
||||
|
@ -28,8 +28,8 @@ package sun.reflect.generics.tree;
|
||||
import sun.reflect.generics.visitor.TypeTreeVisitor;
|
||||
|
||||
public class Wildcard implements TypeArgument {
|
||||
private FieldTypeSignature[] upperBounds;
|
||||
private FieldTypeSignature[] lowerBounds;
|
||||
private final FieldTypeSignature[] upperBounds;
|
||||
private final FieldTypeSignature[] lowerBounds;
|
||||
|
||||
private Wildcard(FieldTypeSignature[] ubs, FieldTypeSignature[] lbs) {
|
||||
upperBounds = ubs;
|
||||
@ -43,11 +43,11 @@ public class Wildcard implements TypeArgument {
|
||||
return new Wildcard(ubs, lbs);
|
||||
}
|
||||
|
||||
public FieldTypeSignature[] getUpperBounds(){
|
||||
public FieldTypeSignature[] getUpperBounds() {
|
||||
return upperBounds;
|
||||
}
|
||||
|
||||
public FieldTypeSignature[] getLowerBounds(){
|
||||
public FieldTypeSignature[] getLowerBounds() {
|
||||
if (lowerBounds.length == 1 &&
|
||||
lowerBounds[0] == BottomSignature.make())
|
||||
return emptyBounds;
|
||||
|
@ -39,7 +39,7 @@ import sun.reflect.generics.factory.*;
|
||||
*/
|
||||
public class Reifier implements TypeTreeVisitor<Type> {
|
||||
private Type resultType;
|
||||
private GenericsFactory factory;
|
||||
private final GenericsFactory factory;
|
||||
|
||||
private Reifier(GenericsFactory f){
|
||||
factory = f;
|
||||
|
@ -40,6 +40,7 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import sun.misc.IOUtils;
|
||||
@ -216,17 +217,21 @@ public final class MethodUtil extends SecureClassLoader {
|
||||
* key in the method cache.
|
||||
*/
|
||||
private static class Signature {
|
||||
private String methodName;
|
||||
private Class<?>[] argClasses;
|
||||
|
||||
private volatile int hashCode = 0;
|
||||
private final String methodName;
|
||||
private final Class<?>[] argClasses;
|
||||
private final int hashCode;
|
||||
|
||||
Signature(Method m) {
|
||||
this.methodName = m.getName();
|
||||
this.argClasses = m.getParameterTypes();
|
||||
this.hashCode = methodName.hashCode() + Arrays.hashCode(argClasses);
|
||||
}
|
||||
|
||||
public boolean equals(Object o2) {
|
||||
@Override public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object o2) {
|
||||
if (this == o2) {
|
||||
return true;
|
||||
}
|
||||
@ -244,25 +249,6 @@ public final class MethodUtil extends SecureClassLoader {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash code computed using algorithm suggested in
|
||||
* Effective Java, Item 8.
|
||||
*/
|
||||
public int hashCode() {
|
||||
if (hashCode == 0) {
|
||||
int result = 17;
|
||||
result = 37 * result + methodName.hashCode();
|
||||
if (argClasses != null) {
|
||||
for (int i = 0; i < argClasses.length; i++) {
|
||||
result = 37 * result + ((argClasses[i] == null) ? 0 :
|
||||
argClasses[i].hashCode());
|
||||
}
|
||||
}
|
||||
hashCode = result;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,7 +319,7 @@ public final class ReflectUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
// disallow any method not declared in one of the proxy intefaces
|
||||
// disallow any method not declared in one of the proxy interfaces
|
||||
throw new IllegalArgumentException("Can't handle: " + method);
|
||||
}
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ public class PolicyFile extends java.security.Policy {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the the global policy for the permissions granted to
|
||||
* Evaluates the global policy for the permissions granted to
|
||||
* the ProtectionDomain and tests whether the permission is
|
||||
* granted.
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ final class EphemeralKeyManager {
|
||||
|
||||
/*
|
||||
* Current cached RSA KeyPairs. Elements are never null.
|
||||
* Indexed via the the constants above.
|
||||
* Indexed via the constants above.
|
||||
*/
|
||||
private final EphemeralKeyPair[] keys = new EphemeralKeyPair[] {
|
||||
new EphemeralKeyPair(null),
|
||||
|
@ -120,7 +120,7 @@ final class MAC extends Authenticator {
|
||||
* @param buf compressed record on which the MAC is computed
|
||||
* @param offset start of compressed record data
|
||||
* @param len the size of the compressed record
|
||||
* @param isSimulated if true, simulate the the MAC computation
|
||||
* @param isSimulated if true, simulate the MAC computation
|
||||
*/
|
||||
final byte[] compute(byte type, byte buf[],
|
||||
int offset, int len, boolean isSimulated) {
|
||||
@ -147,7 +147,7 @@ final class MAC extends Authenticator {
|
||||
* @param type record type
|
||||
* @param bb a ByteBuffer in which the position and limit
|
||||
* demarcate the data to be MAC'd.
|
||||
* @param isSimulated if true, simulate the the MAC computation
|
||||
* @param isSimulated if true, simulate the MAC computation
|
||||
*/
|
||||
final byte[] compute(byte type, ByteBuffer bb, boolean isSimulated) {
|
||||
if (macAlg.size == 0) {
|
||||
|
@ -77,7 +77,7 @@ import javax.net.ssl.SSLEngineResult.*;
|
||||
* All data is routed through
|
||||
* EngineInputRecord/EngineOutputRecord. However, all handshake
|
||||
* data (ct_alert/ct_change_cipher_spec/ct_handshake) are passed
|
||||
* through to the the underlying InputRecord/OutputRecord, and
|
||||
* through to the underlying InputRecord/OutputRecord, and
|
||||
* the data uses the internal buffers.
|
||||
*
|
||||
* Application data is handled slightly different, we copy the data
|
||||
@ -158,7 +158,7 @@ final public class SSLEngineImpl extends SSLEngine {
|
||||
* v |
|
||||
* ERROR>------>----->CLOSED<--------<----+
|
||||
*
|
||||
* ALSO, note that the the purpose of handshaking (renegotiation is
|
||||
* ALSO, note that the purpose of handshaking (renegotiation is
|
||||
* included) is to assign a different, and perhaps new, session to
|
||||
* the connection. The SSLv3 spec is a bit confusing on that new
|
||||
* protocol feature.
|
||||
|
@ -144,7 +144,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
|
||||
* v
|
||||
* APP_CLOSED
|
||||
*
|
||||
* ALSO, note that the the purpose of handshaking (renegotiation is
|
||||
* ALSO, note that the purpose of handshaking (renegotiation is
|
||||
* included) is to assign a different, and perhaps new, session to
|
||||
* the connection. The SSLv3 spec is a bit confusing on that new
|
||||
* protocol feature.
|
||||
@ -2190,7 +2190,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the the SSL Session in use by this connection. These can
|
||||
* Returns the SSL Session in use by this connection. These can
|
||||
* be long lived, and frequently correspond to an entire login session
|
||||
* for some user.
|
||||
*/
|
||||
|
@ -1467,7 +1467,7 @@ final class ServerHandshaker extends Handshaker {
|
||||
if (serverPrincipal != null) {
|
||||
// When service is bound, we check ASAP. Otherwise,
|
||||
// will check after client request is received
|
||||
// in in Kerberos ClientKeyExchange
|
||||
// in Kerberos ClientKeyExchange
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
try {
|
||||
if (sm != null) {
|
||||
|
@ -39,7 +39,7 @@ import sun.security.util.*;
|
||||
* algorithm type, and may also be used in other cases. Equivalence is
|
||||
* defined according to OID and (where relevant) parameters.
|
||||
*
|
||||
* <P>Subclasses may be used, for example when when the algorithm ID has
|
||||
* <P>Subclasses may be used, for example when the algorithm ID has
|
||||
* associated parameters which some code (e.g. code using public keys) needs
|
||||
* to have parsed. Two examples of such algorithms are Diffie-Hellman key
|
||||
* exchange, and the Digital Signature Standard Algorithm (DSS/DSA).
|
||||
|
@ -221,7 +221,7 @@ public class GeneralName {
|
||||
/**
|
||||
* Encode the name to the specified DerOutputStream.
|
||||
*
|
||||
* @param out the DerOutputStream to encode the the GeneralName to.
|
||||
* @param out the DerOutputStream to encode the GeneralName to.
|
||||
* @exception IOException on encoding errors.
|
||||
*/
|
||||
public void encode(DerOutputStream out) throws IOException {
|
||||
|
@ -302,7 +302,7 @@ public class URIName implements GeneralNameInterface {
|
||||
* <p>
|
||||
* RFC5280: For URIs, the constraint applies to the host part of the name.
|
||||
* The constraint may specify a host or a domain. Examples would be
|
||||
* "foo.bar.com"; and ".xyz.com". When the the constraint begins with
|
||||
* "foo.bar.com"; and ".xyz.com". When the constraint begins with
|
||||
* a period, it may be expanded with one or more subdomains. That is,
|
||||
* the constraint ".xyz.com" is satisfied by both abc.xyz.com and
|
||||
* abc.def.xyz.com. However, the constraint ".xyz.com" is not satisfied
|
||||
|
@ -336,7 +336,7 @@ public class X500Name implements GeneralNameInterface, Principal {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an immutable List of the the AVAs contained in all the
|
||||
* Return an immutable List of the AVAs contained in all the
|
||||
* RDNs of this X500Name.
|
||||
*/
|
||||
public List<AVA> allAvas() {
|
||||
|
@ -646,9 +646,9 @@ public final class NormalizerBase implements Cloneable {
|
||||
|
||||
/**
|
||||
* Compose a string.
|
||||
* The string will be composed to according the the specified mode.
|
||||
* The string will be composed according to the specified mode.
|
||||
* @param str The string to compose.
|
||||
* @param compat If true the string will be composed accoding to
|
||||
* @param compat If true the string will be composed according to
|
||||
* NFKC rules and if false will be composed according to
|
||||
* NFC rules.
|
||||
* @param options The only recognized option is UNICODE_3_2
|
||||
@ -694,9 +694,9 @@ public final class NormalizerBase implements Cloneable {
|
||||
|
||||
/**
|
||||
* Decompose a string.
|
||||
* The string will be decomposed to according the the specified mode.
|
||||
* The string will be decomposed according to the specified mode.
|
||||
* @param str The string to decompose.
|
||||
* @param compat If true the string will be decomposed accoding to NFKD
|
||||
* @param compat If true the string will be decomposed according to NFKD
|
||||
* rules and if false will be decomposed according to NFD
|
||||
* rules.
|
||||
* @return String The decomposed string
|
||||
@ -708,9 +708,9 @@ public final class NormalizerBase implements Cloneable {
|
||||
|
||||
/**
|
||||
* Decompose a string.
|
||||
* The string will be decomposed to according the the specified mode.
|
||||
* The string will be decomposed according to the specified mode.
|
||||
* @param str The string to decompose.
|
||||
* @param compat If true the string will be decomposed accoding to NFKD
|
||||
* @param compat If true the string will be decomposed according to NFKD
|
||||
* rules and if false will be decomposed according to NFD
|
||||
* rules.
|
||||
* @param options The normalization options, ORed together (0 for no options).
|
||||
@ -756,7 +756,7 @@ public final class NormalizerBase implements Cloneable {
|
||||
|
||||
/**
|
||||
* Normalize a string.
|
||||
* The string will be normalized according the the specified normalization
|
||||
* The string will be normalized according to the specified normalization
|
||||
* mode and options.
|
||||
* @param src The char array to compose.
|
||||
* @param srcStart Start index of the source
|
||||
|
@ -247,7 +247,7 @@ public abstract class UCharacterIterator
|
||||
|
||||
//// for StringPrep
|
||||
/**
|
||||
* Convenience method for returning the underlying text storage as as string
|
||||
* Convenience method for returning the underlying text storage as a string
|
||||
* @return the underlying text storage in the iterator as a string
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
@ -94,7 +94,7 @@ package sun.text.normalizer;
|
||||
* </li>
|
||||
* <li>
|
||||
* <strong>Exceptions:</strong> The error checking will throw an exception
|
||||
* if indices are out of bounds. Other than than that, all methods will
|
||||
* if indices are out of bounds. Other than that, all methods will
|
||||
* behave reasonably, even if unmatched surrogates or out-of-bounds UTF-32
|
||||
* values are present. <code>UCharacter.isLegal()</code> can be used to check
|
||||
* for validity if desired.
|
||||
|
@ -77,7 +77,8 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
|
||||
public P run() {
|
||||
P delegate = null;
|
||||
|
||||
for (LocaleServiceProvider provider : ServiceLoader.loadInstalled(c)) {
|
||||
for (LocaleServiceProvider provider :
|
||||
ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
|
||||
if (delegate == null) {
|
||||
try {
|
||||
delegate =
|
||||
|
@ -168,6 +168,13 @@ static jlong threadStackSize = 0; /* stack size of the new thread */
|
||||
static jlong maxHeapSize = 0; /* max heap size */
|
||||
static jlong initialHeapSize = 0; /* inital heap size */
|
||||
|
||||
/*
|
||||
* A minimum -Xss stack size suitable for all platforms.
|
||||
*/
|
||||
#ifndef STACK_SIZE_MINIMUM
|
||||
#define STACK_SIZE_MINIMUM (32 * KB)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Entry point.
|
||||
*/
|
||||
@ -737,7 +744,7 @@ parse_size(const char *s, jlong *result) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a new VM option with the given given name and value.
|
||||
* Adds a new VM option with the given name and value.
|
||||
*/
|
||||
void
|
||||
AddOption(char *str, void *info)
|
||||
@ -766,6 +773,14 @@ AddOption(char *str, void *info)
|
||||
jlong tmp;
|
||||
if (parse_size(str + 4, &tmp)) {
|
||||
threadStackSize = tmp;
|
||||
/*
|
||||
* Make sure the thread stack size is big enough that we won't get a stack
|
||||
* overflow before the JVM startup code can check to make sure the stack
|
||||
* is big enough.
|
||||
*/
|
||||
if (threadStackSize < STACK_SIZE_MINIMUM) {
|
||||
threadStackSize = STACK_SIZE_MINIMUM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,9 @@ public class FileKey {
|
||||
|
||||
private FileKey() { }
|
||||
|
||||
public static FileKey create(FileDescriptor fd) {
|
||||
public static FileKey create(FileDescriptor fd) throws IOException {
|
||||
FileKey fk = new FileKey();
|
||||
try {
|
||||
fk.init(fd);
|
||||
} catch (IOException ioe) {
|
||||
throw new Error(ioe);
|
||||
}
|
||||
fk.init(fd);
|
||||
return fk;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
*
|
||||
* However, if the environment contains a LD_LIBRARY_PATH, this will cause the
|
||||
* launcher to inspect the LD_LIBRARY_PATH. The launcher will check
|
||||
* a. if the LD_LIBRARY_PATH's first component is the the path to the desired
|
||||
* a. if the LD_LIBRARY_PATH's first component is the path to the desired
|
||||
* libjvm.so
|
||||
* b. if any other libjvm.so is found in any of the paths.
|
||||
* If case b is true, then the launcher will set the LD_LIBRARY_PATH to the
|
||||
|
@ -2070,7 +2070,7 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
|
||||
* so we switch to IPV6_ADD_MEMBERSHIP socket option.
|
||||
* As of 2.4.7 kernel IPV6_ADD_MEMBERSHIP can't handle IPv4-mapped
|
||||
* addresses so we have to use IP_ADD_MEMBERSHIP for IPv4 multicast
|
||||
* groups. However if the socket is an IPv6 socket then then setsockopt
|
||||
* groups. However if the socket is an IPv6 socket then setsockopt
|
||||
* should return ENOPROTOOPT. We assume this will be fixed in Linux
|
||||
* at some stage.
|
||||
*/
|
||||
|
@ -1053,7 +1053,7 @@ Java_java_net_PlainSocketImpl_socketSendUrgentData(JNIEnv *env, jobject this,
|
||||
} else {
|
||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
/* Bug 4086704 - If the Socket associated with this file descriptor
|
||||
* was closed (sysCloseFD), the the file descriptor is set to -1.
|
||||
* was closed (sysCloseFD), the file descriptor is set to -1.
|
||||
*/
|
||||
if (fd == -1) {
|
||||
JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user