Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 1
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mark Reinhold <[email protected]>
Java™ SE Chief EngineerSun Microsystems
Tigers and Mustangs andDolphins, Oh My!
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 2
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
TigerRoadmap
Release ModelMustangDolphin
Contents
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 4
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
TigerJMX
Concurrency utilities
Generics
Ocean L&F
extended for loop
JVM Monitoring
metadata
SAX 2.0
Enumerated types
printf
importing constants
Autoboxing
Unicode Surrogates
Remote JMX
DOM 3
Gnome Skins
XML Schema
JVMPI Profiling
Stack trace API
JVM sharing
XAWT
AMD64
performance
faster startup
improved footprint
BigDecimal updates
JDBC Rowsets
SASL
New Memory ModelPacked JARs
performance ergonomics
jpsjstat
varargs
aptfatal error handlers
jconsole
OpenGL
synth L&F
improved cookie support
RMI dynamic proxies
z-ordering
swing printingOCSPXDnD
IP reachability
unsynchronized StringBuffer
scanning
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 5
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Over
113,871,645downloads served!
Tiger Adoption
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 6
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
When Will 5.1 Ship?
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 7
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
5.1�5.0 update 5 shipped 2005/9/15
http://java.sun.com/j2se/5.0
When Will 5.1 Ship?
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 8
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
1.4.0 Merlin 2002/2/131.4.1 Hopper 2002/10/161.4.2 Mantis 2003/5/291.5.0 Tiger 2004/9/301.6.0 Mustang 2006/Q31.7.0 Dolphin 2008/Q1
Roadmap
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 9
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
1.4.0 Merlin 2002/2/131.4.1 Hopper 2002/10/161.4.2 Mantis 2003/5/291.5.0 Tiger 2004/9/301.6.0 Mustang 2006/Q31.7.0 Dolphin 2008/Q1
5.1?5.2?
Roadmap
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 10
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
1.4.0 Merlin 2002/2/131.4.1 Hopper 2002/10/161.4.2 Mantis 2003/5/291.5.0 Tiger 2004/9/301.6.0 Mustang 2006/Q31.7.0 Dolphin 2008/Q1
32months
24
18
5.1?5.2?
Roadmap
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 11
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Release Model
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 12
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Feature releases 24–36 months... 1.3, 1.4, 5.0, ...
Release Model
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 13
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Feature releases 24–36 months
Maintenance releases 9–12... 1.3.1, 1.4.1, 1.4.2
Release Model
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 14
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Feature releases 24–36 months
Maintenance releases 9–12
Update releases 3–4... 1.4.2_06, 5.0u4, ...
Release Model
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 15
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Release Model
Old New
Feature releases 24–36 18–24 months
Maintenance releases 9–12 (none)
Update releases 3–4 2–3
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 16
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Why?– Faster, more responsive platform evolution
– Critical fixes delivered, and adopted, more rapidly
– Releases more likely to ship on time
Effective as of J2SE 5.0 “Tiger”
Release Model
Old New
Feature releases 24–36 18–24 months
Maintenance releases 9–12 (none)
Update releases 3–4 2–3
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 17
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
MustangCompiler API
Annotation processors
JVM & CLR Co-Existence
Native L&F Fidelity
Longhorn Look & FeelSplit Verifier
Web Services StackJDBC 4.0 JavaDoc Tags
Scripting Languages
Core JVM
performance
Windows system tray
Attach on
demand
LCD fonts
chmod
Free disk space
Passwordprompting
JavaScript engine
FireFox support
Improved OOM diagnosability
Parallel old-space GC
JVM DTrace
More GC Ergonomics
Pluggable Locales
Improved text renderingXAWT
Docs inChinese
JTable upgrades
JConsole upgradesParallelize Concurrent GC
Faster JNI
Splashscreens
More gfx acceleration
More desktop
integration
Unicode Normalizer
SwingWorker
Services
XML digital signatures
HTTP cookie manager
JAXB 2.0
MBeans
metadata
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 18
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Name That Mustang...
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 19
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Java SE 6.0Java 2
Name That Mustang...
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 20
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Java SE 6.0
Name That Mustang...
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 21
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Java SE 6.0
Name That Mustang!
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 22
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Themes
Compatibility, Stability, & Quality!
Diagnosability, Monitoring, & Management
XML & Web Services
Ease of Development
Enterprise Desktop
Transparency
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 23
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Compiler API
Annotation processors
JVM & CLR Co-Existence
Native L&F Fidelity
Longhorn Look & FeelSplit Verifier
Web Services StackJDBC 4.0 JavaDoc Tags
Scripting Languages
Core JVM
performance
Windows system tray
Attach on
demand
LCD fonts
chmod
Free disk space
Passwordprompting
JavaScript engine
FireFox support
Improved OOM diagnosability
Parallel old-space GC
JVM DTrace
More GC Ergonomics
Pluggable Locales
Improved text renderingXAWT
Docs inChinese
JTable upgrades
JConsole upgradesParallelize Concurrent GC
Faster JNI
Splashscreens
More gfx acceleration
More desktop
integration
Unicode Normalizer
SwingWorker
Services
XML digital signatures
HTTP cookie manager
JAXB 2.0
MBeans
metadata
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 25
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
JSR 270: Java SE 6JSR 270: Release Contents
ApacheBEADavid BockCapgeminiGoogleHPIBMIkayzoIntel
JBossDoug LeaMetasolvOracleSam PullaraSAPSAS InstituteMichael SantosThoughtWorks
Expert Group Members
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 26
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Component JSRs
202: Class File Update
199: Compiler API269: Annotation Processors260: Javadoc Tag Update221: JDBC 4.0223: Scripting
105: XML Digital Signature173: Streaming API for XML222: JAXB 2.0
250: Common Annotations181: WS Metadata224: JAX-WS 2.0
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 27
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Component JSRs
202: Class File Update
199: Compiler API269: Annotation Processors260: Javadoc Tag Update221: JDBC 4.0223: Scripting
105: XML Digital Signature173: Streaming API for XML222: JAXB 2.0
250: Common Annotations181: WS Metadata224: JAX-WS 2.0
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 28
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Component JSRs
202: Class File Update
199: Compiler API269: Annotation Processors260: Javadoc Tag Update221: JDBC 4.0223: Scripting
105: XML Digital Signature173: Streaming API for XML222: JAXB 2.0
250: Common Annotations181: WS Metadata224: JAX-WS 2.0
Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 29
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Component JSRs
202: Class File Update
199: Compiler API269: Annotation Processors260: Javadoc Tag Update221: JDBC 4.0223: Scripting
105: XML Digital Signature173: Streaming API for XML222: JAXB 2.0
250: Common Annotations181: WS Metadata224: JAX-WS 2.0
Ease of Development
XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 30
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mustang Component JSRs
202: Class File Update
199: Compiler API269: Annotation Processors260: Javadoc Tag Update221: JDBC 4.0223: Scripting
105: XML Digital Signature173: Streaming API for XML222: JAXB 2.0
250: Common Annotations181: WS Metadata224: JAX-WS 2.0
Ease of Development
XML
Web Services
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 32
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
202: Class File Update
Primary change: Split verification– Adopted from J2ME™ platform
– Verifier checks compiler-generated assertionsinstead of generating and checking assertions itself
Why?– Simplicity
– Performance
– Sharing code between ME & SE
Mustang Component JSRs
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 33
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
199: Compiler API
import javax.tools.*;
JavaCompilerTool jc= ToolProvider.defaultJavaCompiler();
JavaFileManager fm = jc.getStandardFileManager();jc.setOutputDirectory(new File("classes"));jc.setSourcePath(Arrays.asList(new File("src"),
new File("gen")));jc.setExtendedOption("-Xlint:all");JavaCompilerTool.CompilationTask ct
= jc.run(null,fm.getFileForInput("Test.java"));
for (DiagnosticMessage dm : ct.getDiagnostics())out.println(dm);
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 34
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
269: Annotation Processors
@interface ToDo {String value();
}
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 35
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
269: Annotation Processors
@interface ToDo {String value();
}
@ToDo("Should be package-private")public class CountingStream
extends InputStream{
@ToDo("Check EOF logic!")public int read() throws IOException {
...}
}
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 36
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
269: Annotation Processors
% javac -processor ToDoProcessor Foo.javaread() @ToDo(value=Check EOF logic!)CountingStream @ToDo(value=Should be package-private)%
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 37
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
269: Annotation Processors
public class ToDoProcessorimplements AnnotationProcessor
{
...
public void process() {AnnotationTypeDeclaration toDoDecl
= atds.iterator().next();for (Declaration decl
: env.getDeclarationsAnnotatedWith(toDoDecl)) {System.out.format("%-16s %s%n",
decl.toString(),decl.getAnnotation(ToDo.class));
}}
}
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 38
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
260: Javadoc Tag Update
Properties
Label The string label of the button. (getLabel, setLabel)
ActionCommand The command name of the action event fired by thisbutton. (getActionCommand, setActionCommand)
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 39
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
260: Javadoc Tag Update
Method summaryEvents and related methods
ActionEvent A semantic event indicating that acomponent-defined action occurred.
void addActionListener(ActionListener l)Adds the specified action listener to receive actionevents from this button.
void removeActionListener(ActionListener l)Removes the specified action listener so that it nolonger receives action events from this button.
ActionListener[] getActionListeners()Returns an array of all the action listenersregistered on this button.
protected void processActionEvent(ActionEvent e)Processes action events occurring on this button.
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 40
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
221: JDBC 4.0
private Connection connect(String user, String passwd)throws SQLException
{String url = "jdbc:mysql://javadb.sfbay/jplan";String driver = "com.mysql.jdbc.Driver";try {
Class.forName(driver);return DriverManager.getConnection(url,
user,passwd);
} catch (ClassNotFoundException x) {throw new SQLException("Can't load driver", x);
}}
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 41
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
221: JDBC 4.0
private Connection connect(String user, String passwd)throws SQLException
{String url = "jdbc:mysql://javadb.sfbay/jplan";String driver = "com.mysql.jdbc.Driver";try {
Class.forName(driver);return DriverManager.getConnection(url,
user,passwd);
} catch (ClassNotFoundException x) {throw new SQLException("Can't load driver", x);
}}
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 42
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
221: JDBC 4.0
java.sql.SQLXML
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 43
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
223: Scripting
import javax.script.*;
// Get the built-in JavaScript engineScriptEngineManager sem = new ScriptEngineManager();ScriptEngine se = sem.getEngineByExtension("js");
se.eval("print('Hello, world!')");
Mustang Component JSRs: Ease of Development
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 44
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
173: Streaming API for XML
<favorites-list><favorites>
<who>Laurie</who><color>9a661b</color>
</favorites><favorites>
<who>Brian</who><color>43b120</color>
</favorites><favorites>
<who>Clara</who><color>888314</color>
</favorites><favorites>
<who>Jeff</who><color>61f8ba</color>
</favorites></favorites-list>
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 45
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
173: Streaming API for XML
SAXParserFactory spf = SAXParserFactory.newInstance();SAXParser sp = spf.newSAXParser();final int[] s = new int[1];final int[] n = new int[1];sp.parse(in, new DefaultHandler() {
private boolean inColor = false;StringBuilder color = new StringBuilder();public void startElement(String uri, String ln,
String qn, Attributes as){ inColor = qn.equals("color"); }public void endElement(String uri, String ln, String qn){
if (qn.equals("color")) {s[0] += Integer.parseInt(color.toString(), 16);n[0]++;color.setLength(0);inColor = false;
}}public void characters(char[] ch, int start, int len){ if (inColor) color.append(ch, start, len); }
});return s[0] / n[0];
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 46
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
173: Streaming API for XML
XMLInputFactory xif = XMLInputFactory.newInstance();XMLStreamReader xr = xif.createXMLStreamReader(in);int s = 0;int n = 0;while (xr.hasNext()) {
if (xr.nextTag() == START_ELEMENT) {String ln = xr.getLocalName();if (ln.equals("who")) {
xr.getElementText();} else if (ln.equals("color")) {
s += Integer.parseInt(xr.getElementText(), 16);n++;
}} else if (xr.getLocalName().equals("favorites-list")) {
break;}
}return s / n;
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 47
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
222: JAXB 2.0
<favorites-list><favorites>
<who>Laurie</who><color>9a661b</color>
</favorites><favorites>
<who>Brian</who><color>43b120</color>
</favorites><favorites>
<who>Clara</who><color>888314</color>
</favorites><favorites>
<who>Jeff</who><color>61f8ba</color>
</favorites></favorites-list>
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 48
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
222: JAXB 2.0
public class Favorites {
private String who;public String getWho() { return who; }public void setWho(String w) { who = w; }
private String color;public String getColor() { return color; }public void setColor(String c) { color = c; }
}
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 49
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
222: JAXB 2.0
import javax.xml.bind.annotation.*;
@XmlTypepublic class Favorites {
private String who;public String getWho() { return who; }public void setWho(String w) { who = w; }
private String color;public String getColor() { return color; }public void setColor(String c) { color = c; }
}
Mustang Component JSRs: XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 50
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
224: JAX-WS 2.0 (& 181 & 250)
public class ColorGenerator {
public int generate(String name) {return name.hashCode() & 0xffffff;
}
}
Mustang Component JSRs: Web Services
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 51
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
224: JAX-WS 2.0 (& 181 & 250)
import javax.jws.*;
@WebServicepublic class ColorGenerator {
public int generate(String name) {return name.hashCode() & 0xffffff;
}
}
Mustang Component JSRs: Web Services
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 52
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
224: JAX-WS 2.0 (& 181 & 250)
import javax.xml.ws.*;import java.rmi.RemoteException;
public static int myFavoriteColor()throws WebServiceException, RemoteException
{ServiceFactory serviceFactory
= ServiceFactory.newInstance();ColorGeneratorService service
= (ColorGeneratorService)serviceFactory.loadService(ColorGeneratorService.class);
ColorGenerator cg = service.getColorGeneratorPort();return cg.generate(System.getProperty("user.name"));
}
Mustang Component JSRs: Web Services
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 56
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
@SuppressWarnings
static void createAndShowGUI() {JFrame.setDefaultLookAndFeelDecorated(true);JFrame f = new JFrame("HelloWorldSwing");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label = new JLabel("Hello World");f.getContentPane().add(label);f.pack();f.setVisible(true);
}
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 57
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
@SuppressWarnings
static void createAndShowGUI() {JFrame.setDefaultLookAndFeelDecorated(true);JFrame f = new JFrame("HelloWorldSwing");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label = new JLabel("Hello World");f.getContentPane().add(label);f.pack();f.show();
}
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 58
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
@SuppressWarnings
static void createAndShowGUI() {JFrame.setDefaultLookAndFeelDecorated(true);JFrame f = new JFrame("HelloWorldSwing");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label = new JLabel("Hello World");f.getContentPane().add(label);f.pack();f.show();
}
% javac X.javaNote: X.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.%
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 59
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
@SuppressWarnings
@SuppressWarnings("deprecation")static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);JFrame f = new JFrame("HelloWorldSwing");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label = new JLabel("Hello World");f.getContentPane().add(label);f.pack();f.show();
}
% javac X.java%
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 60
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
@SuppressWarnings
@SuppressWarnings("deprecation")static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);JFrame f = new JFrame("HelloWorldSwing");f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel label = new JLabel("Hello World");f.getContentPane().add(label);f.pack();f.show();
}
% javac X.java%
�� 43votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 61
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Free Disk Space
void safeCopy(File src, File dstDir)throws IOException
{if (src.length() > dstDir.getUsableSpace())
throw new IOException("Insufficient space");doCopy(src,
new File(dstDir.getParent(),src.getName()));
}
�� 697votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 62
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Free Disk Space
void df(File dir) {out.format("Total MB Used Free Use%%%n");long t = dir.getTotalSpace();long f = dir.getFreeSpace();out.format(" %6d %6d %6d %2d%%%n",
t >> 20,(t - f) >> 20,f >> 20,((t - f) * 100) / t);
}
% java DF /aTotal MB Used Free Use%
32766 28632 4134 87%%
�� 697votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 63
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.io.Console
package java.io;
class Consoleimplements Flushable
{String readLine();char[] readPassword(); // No echo!
}
�� 425votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 64
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.io.Console
package java.io;
class Consoleimplements Flushable
{String readLine();char[] readPassword();Console format(String fmt, Object... args);
}
�� 425votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 65
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.io.Console
package java.io;
class Consoleimplements Flushable
{String readLine();char[] readPassword();Console format(String fmt, Object... args);String readLine(String fmt, Object... args);char[] readPassword(String fmt, Object... args);
}
�� 425votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 66
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.io.Console
package java.io;
class Consoleimplements Flushable
{String readLine();char[] readPassword();Console format(String fmt, Object... args);String readLine(String fmt, Object... args);char[] readPassword(String fmt, Object... args);void flush();PrintWriter writer();Reader reader();
}
�� 425votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 67
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Password Prompting
import javax.security.auth.callback.*;
class ConsoleCallbackHandlerimplements CallbackHandler
{public void handle(Callback[] callbacks) {
Console cn = System.console();for (Callback cb : callbacks) {
if (cb instanceof NameCallback) {String nm = cn.readLine("Username: "));((NameCallback)cb).setName(nm);
} else if (cb instanceof PasswordCallback) {char[] pw = cn.readPassword("Password: "));((PasswordCallback)cb).setPassword(pw);Arrays.fill(pw, '\0');
}}
}}
�� 425votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 68
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Class-Path Wildcards
% javac -cp .:./jaxb/lib/jaxb-api.jar\:./jaxb/lib/jaxb-impl.jar\:./jaxb/lib/jsr173_1.0_api.jar\:./jaxb/lib/activation.jar \Sum.java
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 69
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Class-Path Wildcards
% javac -cp .:./jaxb/lib/jaxb-api.jar\:./jaxb/lib/jaxb-impl.jar\:./jaxb/lib/jsr173_1.0_api.jar\:./jaxb/lib/activation.jar \Sum.java
% javac -cp '.:./jaxb/lib/*' Sum.java
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 70
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
JConsole improvements
Reworked UI
Attach-on-Demand
Deadlock detector
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 71
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
DTrace
libc.so.1`_read+0x8libX11.so.4`_XRead+0x38libXt.so.4`XtCreateWidget+0xbclibmawt.so`Java_sun_awt_motif_MToolkit_loadSystemColors+0x184sun/awt/motif/MToolkit.loadSystemColorsjava/awt/SystemColor.updateSystemColorsjava/awt/SystemColor.<clinit>StubRoutines (1)libjvm.so`__1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHandle_pnRJa...libjvm.so`jni_FindClass+0x5c8StubRoutines (1)libmawt.so`Java_sun_awt_motif_MComponentPeer_pSetBackground+0x98sun/awt/motif/MComponentPeer.pSetBackgroundsun/awt/motif/MPanelPeer.setBackgroundsun/awt/motif/MComponentPeer.initializesun/awt/motif/MComponentPeer.initsun/awt/motif/MWindowPeer.initsun/awt/motif/MFramePeer.<init>sun/awt/motif/MToolkit.createFramejava/awt/Frame.addNotifyjava/awt/Window.packSwingSet2.createSplashScreenSwingSet2.<init>SwingSet2.main
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 72
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
DTrace
hotspot$target:::gc-begin {self->ts = vtimestamp;
}
hotspot$target:::gc-finish/self->ts/ {@ = quantize(vtimestamp - self->ts);self->ts = 0;
}
value ------------- Distribution ------------- count16777216 | 033554432 |@@ 167108864 |@@@@@@ 3
134217728 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16268435456 | 0
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 73
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Out-of-Memory Handling
public class Chew {
static void chew() {List<Object> ls = new ArrayList<Object>();for (;;)
ls.add(new byte[1 << 20]);}
public static void main(String[] args) {chew();
}
}
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 74
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Out-of-Memory Handling
public class Chew {
static void chew() {List<Object> ls = new ArrayList<Object>();for (;;)
ls.add(new byte[1 << 20]);}
public static void main(String[] args) {chew();
}
}
% java ChewException java.lang.OutOfMemoryError: Java heap space%
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 75
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Out-of-Memory Handling
public class Chew {
static void chew() {List<Object> ls = new ArrayList<Object>();for (;;)
ls.add(new byte[1 << 20]);}
public static void main(String[] args) {chew();
}
}
% java ChewException java.lang.OutOfMemoryError: Java heap space
at Chew.chew(Chew.java:7)at Chew.main(Chew.java:11)
%
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 76
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.awt.Desktop
import java.awt.Desktop;
void launchBrowser(URI u) {Desktop dt = Desktop.getDesktop();dt.browse(u);
}
�� 138votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 77
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
java.awt.{SystemTray,TrayIcon}
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 78
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Anti-Aliased LCD Text�� 378
votes
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 79
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
20x20 translucent bilinear xform
20x20 opaque drawImage
16 ch antialiased drawString
250x250 antialiased fillOval
20x20 translucent fillRect
250x250 opaque drawLine
0 100000 200000 300000 400000 500000
Java SE 6 (X11)
J2SE 5.0 (OGL)
Java SE 6 (OGL)
pixels/sec (higher is better)
OpenGL Pipeline Improvements
Sun W2100z, Solaris 10, NVidia Quadro FX 1100
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 81
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Baseline/gap API: Matisse
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 82
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
No More Scary Security Dialog!
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 83
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
JRockit
5.0_02 / Suse
Linux
IBM 1.4.2
SR1 / Suse
Linux
Sun J2SE
5.0u2 / Suse
Linux
Sun J2SE
5.0u2 /
Solaris 10
Sun J2SE
5.0u5 /
Solaris 10
Sun Java SE
6 / Solaris 10
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
110%
120%
130%
NormalizedtoJ2SE5.0
64-bit SPECjbb2000
4-CPU 2.4 GHz Sun Fire V40z
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 84
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
JRockit 5.0_02 / SuseLinux
Sun J2SE 5.0u2 /Solaris 10
Sun J2SE 5.0u5 /Solaris 10
Sun Java SE 6 /Solaris 10
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
110%
120%
130%
140%
150%
NormalizedtoJ2SE5.0u2
32-bit SPECjbb2005
4-CPU 2.4 GHz Sun Fire V40z
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 85
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
There’s a lot more...
Just because a featureisn’t mentioned here
doesn’t mean it’snot important!
http://mustang.dev.java.net
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Mark Reinhold — Tigers and Mustangs and Dolphins, Oh My! Page 87
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 88
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Contributions Integrated
4491255: PrintWriter.clearError() to reset internal error state David Tribble
4806463: Self-closing tags incorrectly parsed by Ryan Ackley
javax.swing.text.html.parser.Parser5025230: Creating thread local variables from within Thomas Hawtin
ThreadLocal.initialValue()
5073365: java.lang.Thread.SetPriority() throws Rémi ForaxNullPointerException if a thread has exited
6182942: JButton.isEnabled() return false when button is enabled Anonymous
6197726: IdentityHashMap.entrySet().toArray(T[] a) incorrect Rémi Forax6205522: Javadoc warnings for GregorianCalendar Alexis Ruyant
6207243: Clean up non-varargs warnings during j2se build Andy Tripp
6232484: ArrayList made from IdentityHashMap.entrySet() Rémi Foraxfails to create properly
6248507: AbstractStringBuilder.replace does not handle Nelson Dcosta
count < start < end6257449: Concurrency bug in com.sun.media.sound.UlawCodec Jesse Stir
6261423: Dropouts in audio recordings Klaus Jänsch
6272233: JPanel not popping up menu set in setComponentPopup Anonymous6298794: Construction performance of user-created AWT Thomas Hawtin
components has become very slow
6298940: AbstractButton.setModel doesn't fully update mnemonic Thomas Hawtin
THANKS!
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 89
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Contributions In Process
4094886: Need a load(Reader)/store(Writer) interface for Properties class
4238932: A JTextField in gridBagLayout does not properly set MinimumSize
4263142: Point2D.Double and Point2D.Float should be Serializable
4306897: Add java.util.Arrays.binarySearch(a, key, fromIndex, toIndex)
4322996: Add BasicComboBoxEditor constructor that accepts a JTextField
4346256: Provide an AbstractTreeModel for the TreeModel hierarchy
4511638: Double.toString(double) sometimes produces incorrect results
4679743: Additional Compressed Streams Requested
4726458: Dialogs and Frames are never garbage collected
4741757: LTP: XMLEncoder ignores persistence delegates when used
with Java Web Start
4854174: FileSystemView.getSystemIcon throws NPE for bad soft links
4854950: JFrame's decorated root pane doesn't like MouseListeners
4890726: Linux version of JDK doesn't support uk_UA.KOI8-U locale
4941777: Deprecate Boolean constructor
4974934: Wait unprotected from spurious wakeups in EventQueue.invokeAndWait
4993740: Scanner should implement Iterable<String>
5005831: String constructors and method which take Charset rather than String
5015163: String merge/join facility that would be the inverse of java.lang.String.split()
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 90
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
More Contributions In Process
5041975: Please retrofit varargs onto java.lang.reflect.Array.newInstance
5084229: NamingEnumeration should be closed when parent DirContext is closed
6176992: Add support to java.lang.Class for wrapper type conversions
6246565: File descriptor leak when using DatagramChannel.socket()
6254531: ThreadLocal leak when value references ThreadLocal
6261423: Dropouts in audio recordings
6284152: Lookbehinds with internal quantifiers are unreliable
6303905: Current MD5 implementation is the bottleneck of my application
6305029: Identity Transform does not demand namespace-prefixes
6306820: Extend Java's 'URL parameters' manipulation capabilites
6307385: Locale performance and correctness fixes
6307387: Add String.endsWithIgnoreCase(String suffix)
6314708: File should provide methods to access created and last-access times
6314710: java.security.MessageDigestSpi: Re-use byte[] for better performance
6315064: String.equals ignores pre-calulated hash codes
6328849: Make it easier to customize the Swing action framework
6335626: Swing Tutorial should use MVC
6339846: HotSpot build failures on AMD64 Fedora Core 4
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 91
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
More Contributions In Process
5041975: Please retrofit varargs onto java.lang.reflect.Array.newInstance
5084229: NamingEnumeration should be closed when parent DirContext is closed
6176992: Add support to java.lang.Class for wrapper type conversions
6246565: File descriptor leak when using DatagramChannel.socket()
6254531: ThreadLocal leak when value references ThreadLocal
6261423: Dropouts in audio recordings
6284152: Lookbehinds with internal quantifiers are unreliable
6303905: Current MD5 implementation is the bottleneck of my application
6305029: Identity Transform does not demand namespace-prefixes
6306820: Extend Java's 'URL parameters' manipulation capabilites
6307385: Locale performance and correctness fixes
6307387: Add String.endsWithIgnoreCase(String suffix)
6314708: File should provide methods to access created and last-access times
6314710: java.security.MessageDigestSpi: Re-use byte[] for better performance
6315064: String.equals ignores pre-calulated hash codes
6328849: Make it easier to customize the Swing action framework
6335626: Swing Tutorial should use MVC
6339846: HotSpot build failures on AMD64 Fedora Core 4
XXXXXX:YOUR FAVORITE BUG OR RFE HERE
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 92
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
DolphinLanguage-level XML
Modules
Friends invokedynamic bytecode
Performance
Tiered Compilation
Class-data sharing for applications
Class-loader based application isolation
Tracing
Resolution-Independent Graphics
Filesystem API
Asynchronous I/O
Web Services for JMX
Client Ergonomics
Docking
HTML 4.0
Method References
BeanShell
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 93
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Modules
JAR files haven’t scaled well– Sharing
– Isolation
– Versioning
– Native code
– Composition
– Dependencies
JSR 277 will try to address these problems
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 94
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
void addReviewer(Element feature,String user, String time)
{// DOMDocument doc = feature.getOwnerDocument();Element review = doc.createElement("reviewed");Element who = doc.createElement("who");who.setTextContent(user);review.appendChild(who);Element when = doc.createElement("when");when.setTextContent(time);review.appendChild(when);feature.appendChild(review);
}
Language-Level XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 95
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
void addReviewer(Element feature,String user, String time)
{feature.add(<reviewed><who>{ user }</who>
<when>{ time }</when></reviewed>);
}
Language-Level XML
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 96
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
You Can Participate!
http://mustang.dev.java.net
Review JSRs in progress– Submit comments to Expert Groups
Download Mustang builds– Do the new APIs meet your needs?
– Do your existing applications still work?
Collaborate on the Mustang code itself!
Mark Reinhold – Tigers and Mustangs and Dolphins, Oh My! Page 97
Colorado Software Summit: October 23 – 28, 2005 © Copyright 2005, Sun Microsystems, Inc.
Thank you!
Mark Reinhold<[email protected]>
Questions?