first adoption hackathon at bgjug
TRANSCRIPT
![Page 1: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/1.jpg)
Adopt OpenJDK
Hackathon, 11 Dec. 2014
![Page 2: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/2.jpg)
Agenda of the hackathon
Build OpenJDK
Improve OpenJDK
Write some tests
Create patch
Submit patch
![Page 3: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/3.jpg)
Agenda of the hackathon
Build OpenJDK
Improve OpenJDK
Write some tests
Create patch
Submit patch
While building…
◦ Intro to OpenJDK
![Page 4: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/4.jpg)
Let’s get it going
Import VM and login
Change to openjdk directory
cd $SOURCE_CODE/jdk9
Get the sources
bash get_sources.sh
Configure
bash configure
Make images
make clean images
![Page 5: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/5.jpg)
OpenJDK overview
Free and open-source implementation of the Java Platform, Standard Edition
Base for the Oracle VM
GPL v2 for the VMs and GPL v2 + classpath exception for class libraries
Major contributors:◦ IBM
◦ Apple
◦ RedHat
◦ SAP
◦ A lot of JUGs
![Page 6: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/6.jpg)
Why bother?
Move Java forward
Give back something to the platform
Help our JUG gain its own identity and
focus
Acquire new knowledge
Have some fun and socialize
![Page 7: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/7.jpg)
How can we help?
Introductory level
◦ Fix compiler warnings
◦ Generify, coinify and labdify internal APIs
◦ Add new tests, convert existing tests
◦ Fix typos, add javadoc
Next level
◦ Affiliate with an existing project (Jigsaw,
Nashorn)
◦ Help with new stuff in project Valhalla
![Page 8: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/8.jpg)
Development process
Sign OCA
Find interesting bug or enhancement
Discuss with sponsoring project
mailing list
Get together and create a patch
◦ Don’t forget the tests!
Upload the patch and contact ML
again
Be proud of yourself!
![Page 9: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/9.jpg)
Task selection (1)
Add getStackTraceString() to Throwable
Usually people do:catch (MyException e) {
StringWriter sw = new StringWriter();e.printStackTrace(
new PrintWriter(sw));}
Look at existing solutions (Apache Commons)
https://bugs.openjdk.java.net/browse/JDK-5050783
![Page 10: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/10.jpg)
Task selection (2)
Generic support to Collection bulk methods
addAll, containsAll, removeAll, retainAll can only receive other collections
You have to an intermediate Arrays.asList:
collection.addAll(Arrays.asList("a", "b", "c"));
Consider using default methods
https://bugs.openjdk.java.net/browse/JDK-6201180
![Page 11: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/11.jpg)
Task selection (3)
Replace array parameters with
varargs
Look throughout all internal APIs
Supported since JDK 1.5
Discuss with Joe Darcy and team
https://bugs.openjdk.java.net/browse/J
DK-4974893
![Page 12: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/12.jpg)
Write some tests
JTreg: the legacy◦ Java program with main method
◦ If test fails, testcase should throw an exception
◦ If it succeeds, testcase should return normally
/* @test
* @summary StringBuffer.isEmpty();
* @run main IsEmptyTest
*/
public class IsEmptyTest {
public static void main(String[] args) {
StringBuffer buffer = new StringBuffer();
if (!buffer.isEmpty()) {
throw new RuntimeException("StringBuffer isEmpty on newobject failed");
}
}
}
![Page 13: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/13.jpg)
Test “docklets”
@test – defines a test. Mandatory.
@run – tells how to perform a test.
@summary – text description.
@library – reference library source files.
@build – compile class or library before running test
@bug – bug number reference
@key – keywords
![Page 14: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/14.jpg)
TestNG support
TestNG is cool and nicely supported
TestNG test cases are run through jtreg
Two types of tests
Type 1◦ Describe the test in JTreg “docklets”
◦ No main method required/* @test
* @summary comments about your test;
* @run testng YourTest
*/
Type 2◦ Describe the test in TEST.ROOT or TESTS.properties
TestNG.dirs = .
othervm.dirs = tck/java/time/chronotest/java/time/chrono test/java/time/format
![Page 15: First adoption hackathon at BGJUG](https://reader030.vdocuments.us/reader030/viewer/2022032422/55a928f71a28abb3768b4778/html5/thumbnails/15.jpg)
Create a patch
Let’s contribute
cd $SOURCE_CODE/jdk9
Commit in Mercurial
hg status
hg commit
Run webrev
ksh ../webrev.ksh
Upload to web server
$SOURCE_CODE/jdk9/webrev