# HG changeset patch # User Jaroslav Tulach # Date 1213430288 -7200 # Node ID b5cbb797ec0a1a971ab95d25d7d1045cf048fcca # Parent eb6f29070331935555f723698b1501e1eb68aa16 up to line 2000 diff -r eb6f29070331 -r b5cbb797ec0a samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java --- a/samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/apifest1/boolcircuit/test/org/netbeans/apifest/boolcircuit/CircuitTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -1,5 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + package org.netbeans.apifest.boolcircuit; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Policy; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; import junit.framework.TestCase; import junit.framework.*; @@ -15,24 +41,20 @@ * on output 1 and 1 to 0 *
  • and - has two inputs and one output. The output is 1 only if both * inputs are 1, otherwise it is 0 - *
  • or - has two inputs and one output. The output is 1 always, - * except in the case when both inputs are 0 + *
  • or - has two inputs and one output. The output is 1 always, except + * in the case when both inputs are 0 * * *

    - * The boolean circuit can be used to represent boolean formulas and - * compute the results for certain values of its inputs. The individual - * tasks described as tests bellow. + * The boolean circuit can be used to represent boolean formulas and compute + * the results for certain values of its inputs. The individual tasks described + * as tests bellow. * *

    * Links of interest: *

    */ public class CircuitTest extends TestCase { diff -r eb6f29070331 -r b5cbb797ec0a samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml --- a/samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/apifest1/day1/inputandoperation/nbproject/build-impl.xml Sat Jun 14 09:58:08 2008 +0200 @@ -19,7 +19,7 @@ - cleanup --> - + - - Builds, tests, and runs the project pinbasedsolution - day1. + + Builds, tests, and runs the project pinbasedsolution. - + - - Builds, tests, and runs the project stackbasedsolution - day1. + + Builds, tests, and runs the project stackbasedsolution. - + - + - - Builds, tests, and runs the project welltestedsolution - day2. + + Builds, tests, and runs the project welltestedsolution. - + diff -r eb6f29070331 -r b5cbb797ec0a samples/composition/nbproject/project.xml --- a/samples/composition/nbproject/project.xml Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/composition/nbproject/project.xml Sat Jun 14 09:58:08 2008 +0200 @@ -23,29 +23,11 @@ UTF-8 - - java - src-api2.0-compat - UTF-8 - - - - java - src-api2.0-property - UTF-8 - - java src-test UTF-8 - - - java - src-api2.0-enum - UTF-8 - @@ -57,9 +39,6 @@ test - - test - clean build @@ -76,18 +55,6 @@ src-api2.0 - - src-api2.0-compat - - - - src-api2.0-property - - - - src-api2.0-enum - - src-test @@ -98,7 +65,6 @@ - @@ -114,18 +80,6 @@ 1.5 - src-api2.0-compat - 1.5 - - - src-api2.0-enum - 1.5 - - - src-api2.0-property - 1.5 - - src-test src-api1.0:../libs/dist/junit-4.4.jar 1.5 diff -r eb6f29070331 -r b5cbb797ec0a samples/conditionaluseofapi/src/conditionaluseofapi/Main.java --- a/samples/conditionaluseofapi/src/conditionaluseofapi/Main.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/conditionaluseofapi/src/conditionaluseofapi/Main.java Sat Jun 14 09:58:08 2008 +0200 @@ -24,10 +24,7 @@ try { Class onlyOn15 = Class.forName("java.lang.StringBuilder"); - Class codeOn15 = Class.forName( - "conditionaluseofapi.StringBuilderAdd15" - ); - add = (AddString)codeOn15.newInstance(); + add = (AddString)Class.forName("conditionaluseofapi.StringBuilderAdd15").newInstance(); } catch (ClassNotFoundException ex) { add = new StringBufferAdd(); } diff -r eb6f29070331 -r b5cbb797ec0a samples/consistency/src-api1.0/api/Lookup.java --- a/samples/consistency/src-api1.0/api/Lookup.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/consistency/src-api1.0/api/Lookup.java Sat Jun 14 09:58:08 2008 +0200 @@ -20,9 +20,7 @@ // END: design.consistency.lookupAll.1.0 // BEGIN: design.consistency.lookupAllClasses.1.0 - public abstract Set> lookupAllClasses( - Class clazz - ); + public abstract Set> lookupAllClasses(Class clazz); // END: design.consistency.lookupAllClasses.1.0 } // END: design.consistency.1.0 diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/src/org/apidesign/deadlock/logs/OverrideMePlease.java --- a/samples/deadlock/src/org/apidesign/deadlock/logs/OverrideMePlease.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/src/org/apidesign/deadlock/logs/OverrideMePlease.java Sat Jun 14 09:58:08 2008 +0200 @@ -11,9 +11,7 @@ } // BEGIN: logs.override protected boolean overideMePlease() { - Logger.getLogger(OverrideMePlease.class.getName()).warning( - "subclasses are supposed to override overideMePlease() method!" - ); + Logger.getLogger(OverrideMePlease.class.getName()).warning("subclasses are supposed to override overideMePlease() method!"); // some default return true; } diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandler.java --- a/samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandler.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandler.java Sat Jun 14 09:58:08 2008 +0200 @@ -19,9 +19,7 @@ } // otherwise try to create the file yourself lockFile.createNewFile(); - DataOutputStream os = new DataOutputStream( - new FileOutputStream(lockFile) - ); + DataOutputStream os = new DataOutputStream(new FileOutputStream(lockFile)); ServerSocket server = new ServerSocket(); int p = server.getLocalPort(); os.writeInt(p); diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandlerBlocking.java --- a/samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandlerBlocking.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/src/org/apidesign/deadlock/startuplock/CLIHandlerBlocking.java Sat Jun 14 09:58:08 2008 +0200 @@ -24,9 +24,7 @@ // otherwise try to create the file yourself enterState(20); lockFile.createNewFile(); - DataOutputStream os = new DataOutputStream( - new FileOutputStream(lockFile) - ); + DataOutputStream os = new DataOutputStream(new FileOutputStream(lockFile)); ServerSocket server = new ServerSocket(); enterState(21); int p = server.getLocalPort(); diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/test/org/apidesign/deadlock/DeadlockTest.java --- a/samples/deadlock/test/org/apidesign/deadlock/DeadlockTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/test/org/apidesign/deadlock/DeadlockTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -14,9 +14,7 @@ // BEGIN: deadlock.test public class DeadlockTest extends NbTestCase { - static final Logger LOG = Logger.getLogger( - DeadlockTest.class.getName() - ); + static final Logger LOG = Logger.getLogger(DeadlockTest.class.getName()); public DeadlockTest(String n) { super(n); @@ -36,10 +34,7 @@ JLabel sampleLabel = createLabel(); return sampleLabel.getPreferredSize(); } catch (InterruptedException ex) { - Logger l = Logger.getLogger( - DeadlockTest.class.getName() - ); - l.log(Level.SEVERE, null, ex); + Logger.getLogger(DeadlockTest.class.getName()).log(Level.SEVERE, null, ex); return super.getPreferredSize(); } } diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/test/org/apidesign/deadlock/LabelProviderTest.java --- a/samples/deadlock/test/org/apidesign/deadlock/LabelProviderTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/test/org/apidesign/deadlock/LabelProviderTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -13,9 +13,7 @@ // BEGIN: deadlock.test.controlflow public class LabelProviderTest extends NbTestCase { - static final Logger LOG = Logger.getLogger( - LabelProviderTest.class.getName() - ); + static final Logger LOG = Logger.getLogger(LabelProviderTest.class.getName()); public LabelProviderTest(String n) { super(n); diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/test/org/apidesign/deadlock/logs/ParallelSortedTest.java --- a/samples/deadlock/test/org/apidesign/deadlock/logs/ParallelSortedTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/test/org/apidesign/deadlock/logs/ParallelSortedTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -37,8 +37,7 @@ if (!record.getMessage().startsWith("cnt")) { return; } - boolean snd = Thread.currentThread().getName().equals("2nd"); - if (runSecond == snd) { + if (runSecond == Thread.currentThread().getName().equals("2nd")) { notify(); runSecond = !runSecond; } diff -r eb6f29070331 -r b5cbb797ec0a samples/deadlock/test/org/apidesign/deadlock/startuplock/CLIHandlerBlockingTest.java --- a/samples/deadlock/test/org/apidesign/deadlock/startuplock/CLIHandlerBlockingTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/deadlock/test/org/apidesign/deadlock/startuplock/CLIHandlerBlockingTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -52,5 +52,5 @@ public void close() throws SecurityException { } } // end of H -} // END: test.capture.logs +} \ No newline at end of file diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriter/nbproject/project.properties --- a/samples/delegatingwriter/nbproject/project.properties Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriter/nbproject/project.properties Sat Jun 14 09:58:08 2008 +0200 @@ -1,5 +1,3 @@ -application.title=delegatingwriter -application.vendor=jarda build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: @@ -18,7 +16,6 @@ dist.jar=${dist.dir}/delegatingwriter.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= -file.reference.junit-4.4.jar=../libs/dist/junit-4.4.jar includes=** jar.compress=false javac.classpath= @@ -30,7 +27,8 @@ javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ - ${file.reference.junit-4.4.jar} + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriter/src/org/apidesign/delegatingwriter/AltBufferedWriter.java --- a/samples/delegatingwriter/src/org/apidesign/delegatingwriter/AltBufferedWriter.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriter/src/org/apidesign/delegatingwriter/AltBufferedWriter.java Sat Jun 14 09:58:08 2008 +0200 @@ -1,3 +1,8 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + package org.apidesign.delegatingwriter; import java.io.BufferedWriter; @@ -28,25 +33,18 @@ @Override public Writer append(CharSequence csq) throws IOException { switch (behaviour) { - case THROW_EXCEPTION: - return appendThrowException(csq); - case DELEGATE_TO_SUPER: - return appendDelegateToSuper(csq); - case DELEGATE_TO_OUT: - return appendDelegateToUnderlaying(csq); - case DELEGATE_CONDITIONALLY: - return appendDelegateConditionally(csq); - default: - throw new IllegalStateException("Unknown" + behaviour); + case THROW_EXCEPTION: return appendThrowException(csq); + case DELEGATE_TO_SUPER: return appendDelegateToSuper(csq); + case DELEGATE_TO_OUT: return appendDelegateToUnderlaying(csq); + case DELEGATE_CONDITIONALLY: return appendDelegateConditionally(csq); + default: throw new IllegalStateException("Unknown" + behaviour); } } public Writer appendThrowException(CharSequence csq) throws IOException { - /* in case of real code, this would be part of - the regular append method. BEGIN: writer.throw + /* in case of real code, this would be part of the regular append method BEGIN: writer.throw public Writer append(CharSequence csq) throws IOException { - /* thrown an exception as this method is new and - subclasses need to override it */ + /* thrown an exception as this method is new and subclasses need to override it */ throw new UnsupportedOperationException(); } // END: writer.throw @@ -78,27 +76,14 @@ // END: writer.delegateout } - private Writer appendDelegateConditionally(CharSequence csq) - throws IOException { + private Writer appendDelegateConditionally(CharSequence csq) throws IOException { // BEGIN: writer.conditionally boolean isOverriden = false; try { isOverriden = - ( - getClass().getMethod( - "write", String.class - ).getDeclaringClass() != Writer.class - ) || - ( - getClass().getMethod( - "write", Integer.TYPE - ).getDeclaringClass() != BufferedWriter.class - ) || - ( - getClass().getMethod( - "write", String.class, Integer.TYPE, Integer.TYPE - ).getDeclaringClass() != BufferedWriter.class - ); + (getClass().getMethod("write", String.class).getDeclaringClass() != Writer.class) || + (getClass().getMethod("write", Integer.TYPE).getDeclaringClass() != BufferedWriter.class) || + (getClass().getMethod("write", String.class, Integer.TYPE, Integer.TYPE).getDeclaringClass() != BufferedWriter.class); } catch (Exception ex) { throw new IOException(ex); } @@ -114,9 +99,6 @@ } public enum Behaviour { - THROW_EXCEPTION, - DELEGATE_TO_SUPER, - DELEGATE_TO_OUT, - DELEGATE_CONDITIONALLY + THROW_EXCEPTION, DELEGATE_TO_SUPER, DELEGATE_TO_OUT, DELEGATE_CONDITIONALLY } } diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriter/test/org/apidesign/delegatingwriter/BufferedWriterOnCDImageTest.java --- a/samples/delegatingwriter/test/org/apidesign/delegatingwriter/BufferedWriterOnCDImageTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriter/test/org/apidesign/delegatingwriter/BufferedWriterOnCDImageTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -23,10 +23,7 @@ CDSequence cdImage = new CDSequence(); BufferedWriter bufferedWriter = new BufferedWriter(writer); bufferedWriter.append(cdImage); - assertEquals( - "Correct number of writes delegated", - cdImage.length(), writer.getCharacterCount() - ); + assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount()); // END: writer.countcd } @@ -34,30 +31,18 @@ public void testBehaviourOfBufferThatDelegatesToAppend() throws IOException { CountingWriter writer = new CountingWriter(); CDSequence cdImage = new CDSequence(); - BufferedWriter bufferedWriter = new AltBufferedWriter( - writer, AltBufferedWriter.Behaviour.DELEGATE_TO_OUT - ); + BufferedWriter bufferedWriter = new AltBufferedWriter(writer, AltBufferedWriter.Behaviour.DELEGATE_TO_OUT); bufferedWriter.append(cdImage); - assertEquals( - "Correct number of writes delegated", - cdImage.length(), - writer.getCharacterCount() - ); + assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount()); } @Test public void testBehaviourWhenDelegatingConditionallyIsOK() throws IOException { CountingWriter writer = new CountingWriter(); CDSequence cdImage = new CDSequence(); - BufferedWriter bufferedWriter = new AltBufferedWriter( - writer, AltBufferedWriter.Behaviour.DELEGATE_CONDITIONALLY - ); + BufferedWriter bufferedWriter = new AltBufferedWriter(writer, AltBufferedWriter.Behaviour.DELEGATE_CONDITIONALLY); bufferedWriter.append(cdImage); - assertEquals( - "Correct number of writes delegated", - cdImage.length(), - writer.getCharacterCount() - ); + assertEquals("Correct number of writes delegated", cdImage.length(), writer.getCharacterCount()); } @@ -82,7 +67,7 @@ public int length() { return end - start; } -// FINISH: writer.bigseq +// END: writer.bigseq public char charAt(int index) { int ch = index % ('Z' - 'A' + 1); diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriter/test/org/apidesign/delegatingwriter/CountingWriter.java --- a/samples/delegatingwriter/test/org/apidesign/delegatingwriter/CountingWriter.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriter/test/org/apidesign/delegatingwriter/CountingWriter.java Sat Jun 14 09:58:08 2008 +0200 @@ -27,7 +27,7 @@ counter += csq.length(); return this; } -// FINISH: writer.CountingWriter +// END: writer.CountingWriter @Override public Writer append(CharSequence csq, int start, int end) throws IOException { diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriter/test/org/apidesign/delegatingwriter/CryptoWriter.java --- a/samples/delegatingwriter/test/org/apidesign/delegatingwriter/CryptoWriter.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriter/test/org/apidesign/delegatingwriter/CryptoWriter.java Sat Jun 14 09:58:08 2008 +0200 @@ -13,9 +13,7 @@ public CryptoWriter(Writer out) { super(out); } - public CryptoWriter( - Writer out, AltBufferedWriter.Behaviour behaviour - ) { + public CryptoWriter(Writer out, AltBufferedWriter.Behaviour behaviour) { super(out, behaviour); } /* The above code is here to let us simulate different behaviours of the append @@ -26,15 +24,15 @@ super(out); } - /* We need to override all known methods of BufferedWriter - * and do conversion of the argument char, string or char array. + /* We need to override all known methods of BufferedWriter and do conversion + * of the argument char, string or char array. */ @Override - public void write(char[] buf, int off, int len) throws IOException { + public void write(char[] cbuf, int off, int len) throws IOException { char[] arr = new char[len]; for (int i = 0; i < len; i++) { - arr[i] = convertChar(buf[off + i]); + arr[i] = convertChar(cbuf[off + i]); } super.write(arr, 0, len); } @@ -62,7 +60,7 @@ } return (char)(c + 1); } -// FINISH: writer.CryptoWriter +// END: writer.CryptoWriter /* delegates to write(cbuf, 0, cbuf.length) public void write(char[] cbuf) throws IOException { diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriterfinal/src-api1.0/api/Writer.java --- a/samples/delegatingwriterfinal/src-api1.0/api/Writer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriterfinal/src-api1.0/api/Writer.java Sat Jun 14 09:58:08 2008 +0200 @@ -22,15 +22,13 @@ public final void write(char cbuf[]) throws IOException { impl.write(cbuf, 0, cbuf.length); } - public final void write(char cbuf[], int off, int len) - throws IOException { + public final void write(char cbuf[], int off, int len) throws IOException { impl.write(cbuf, off, len); } public final void write(String str) throws IOException { impl.write(str, 0, str.length()); } - public final void write(String str, int off, int len) - throws IOException { + public final void write(String str, int off, int len) throws IOException { impl.write(str, off, len); } public final void flush() throws IOException { @@ -46,13 +44,11 @@ public static Writer create(final java.io.Writer w) { return new Writer(new Impl() { - public void write(String str, int off, int len) - throws IOException { + public void write(String str, int off, int len) throws IOException { w.write(str, off, len); } - public void write(char[] arr, int off, int len) - throws IOException { + public void write(char[] arr, int off, int len) throws IOException { w.write(arr, off, len); } @@ -74,8 +70,8 @@ public static interface Impl { public void close() throws IOException; public void flush() throws IOException; - public void write(String s, int off, int len) throws IOException; - public void write(char[] a, int off, int len) throws IOException; + public void write(String str, int off, int len) throws IOException; + public void write(char[] arr, int off, int len) throws IOException; } } // END: writer.final.1.0 diff -r eb6f29070331 -r b5cbb797ec0a samples/delegatingwriterfinal/src-api2.0/api/Writer.java --- a/samples/delegatingwriterfinal/src-api2.0/api/Writer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/delegatingwriterfinal/src-api2.0/api/Writer.java Sat Jun 14 09:58:08 2008 +0200 @@ -32,8 +32,7 @@ seq.write(new CharSeq(cbuf, 0, cbuf.length)); } } - public final void write(char cbuf[], int off, int len) - throws IOException { + public final void write(char cbuf[], int off, int len) throws IOException { if (impl != null) { impl.write(cbuf, off, len); } else { @@ -47,8 +46,7 @@ seq.write(str); } } - public final void write(String str, int off, int len) - throws IOException { + public final void write(String str, int off, int len) throws IOException { if (impl != null) { impl.write(str, off, len); } else { @@ -83,8 +81,7 @@ return this; } - public final Writer append(CharSequence csq, int start, int end) - throws IOException { + public final Writer append(CharSequence csq, int start, int end) throws IOException { return append(csq.subSequence(start, end)); } diff -r eb6f29070331 -r b5cbb797ec0a samples/differentreturntype/build.xml --- a/samples/differentreturntype/build.xml Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/differentreturntype/build.xml Sat Jun 14 09:58:08 2008 +0200 @@ -6,26 +6,18 @@ - + - + g3tIcon getIcon diff -r eb6f29070331 -r b5cbb797ec0a samples/differentreturntype/src-api1.0/api/API.java --- a/samples/differentreturntype/src-api1.0/api/API.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/differentreturntype/src-api1.0/api/API.java Sat Jun 14 09:58:08 2008 +0200 @@ -5,7 +5,7 @@ public abstract class API { // BEGIN: theory.binary.differentreturntype.api public static Icon getIcon() { - return null; // compute something +// END: theory.binary.differentreturntype.api + return null; } -// END: theory.binary.differentreturntype.api } diff -r eb6f29070331 -r b5cbb797ec0a samples/differentreturntype/src-api2.0/api/API.java --- a/samples/differentreturntype/src-api2.0/api/API.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/differentreturntype/src-api2.0/api/API.java Sat Jun 14 09:58:08 2008 +0200 @@ -5,7 +5,7 @@ public abstract class API { // BEGIN: theory.binary.differentreturntype.api2 public static ImageIcon getIcon() { +// END: theory.binary.differentreturntype.api2 return null; } -// END: theory.binary.differentreturntype.api2 } diff -r eb6f29070331 -r b5cbb797ec0a samples/extensibleicon/src/org/apidesign/extensibleicon/CatQuery.java --- a/samples/extensibleicon/src/org/apidesign/extensibleicon/CatQuery.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/extensibleicon/src/org/apidesign/extensibleicon/CatQuery.java Sat Jun 14 09:58:08 2008 +0200 @@ -7,18 +7,14 @@ private CatQuery() { } public static boolean isCat(ExtIcon icon) { - for (CatQueryImplementation impl : - Lookup.getDefault().lookupAll(CatQueryImplementation.class) - ) { + for (CatQueryImplementation impl : Lookup.getDefault().lookupAll(CatQueryImplementation.class)) { Boolean res = impl.isCat(icon); if (res != null) { return res; } } - for (CatQueryImplementation impl : - icon.getLookup().lookupAll(CatQueryImplementation.class) - ) { + for (CatQueryImplementation impl : icon.getLookup().lookupAll(CatQueryImplementation.class)) { Boolean res = impl.isCat(icon); if (res != null) { return res; diff -r eb6f29070331 -r b5cbb797ec0a samples/extensibleicon/src/org/apidesign/extensibleicon/Icon2Image.java --- a/samples/extensibleicon/src/org/apidesign/extensibleicon/Icon2Image.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/extensibleicon/src/org/apidesign/extensibleicon/Icon2Image.java Sat Jun 14 09:58:08 2008 +0200 @@ -12,11 +12,7 @@ if (img != null) { return img; } - BufferedImage buf = new BufferedImage( - icon.getIconWidth(), - icon.getIconHeight(), - BufferedImage.TYPE_INT_RGB - ); + BufferedImage buf = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB); icon.paintIcon(null, buf.getGraphics(), 0, 0); return buf; } diff -r eb6f29070331 -r b5cbb797ec0a samples/extensionpoint/src-api/org/apidesign/extensionpoint/Main.java --- a/samples/extensionpoint/src-api/org/apidesign/extensionpoint/Main.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/extensionpoint/src-api/org/apidesign/extensionpoint/Main.java Sat Jun 14 09:58:08 2008 +0200 @@ -12,8 +12,7 @@ public static void main(String[] args) { for (;;) { // BEGIN: extension.point.Query - Collection all = - Lookup.getDefault().lookupAll(TipOfTheDay.class); + Collection all = Lookup.getDefault().lookupAll(TipOfTheDay.class); List arr = new ArrayList(all); Collections.shuffle(arr); @@ -34,9 +33,7 @@ String again = "Once Again"; String exit = "Exit"; String[] options = new String[] { again, exit }; - int ret = JOptionPane.showOptionDialog( - null, msg, title, 0, type, null, options, exit - ); + int ret = JOptionPane.showOptionDialog(null, msg, title, 0, type, null, options, exit); if (ret != 0) { break; diff -r eb6f29070331 -r b5cbb797ec0a samples/forjoe/src-api1.0/api/InterfaceThatJustJoeCanImplement.java --- a/samples/forjoe/src-api1.0/api/InterfaceThatJustJoeCanImplement.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/forjoe/src-api1.0/api/InterfaceThatJustJoeCanImplement.java Sat Jun 14 09:58:08 2008 +0200 @@ -4,9 +4,7 @@ public abstract class InterfaceThatJustJoeCanImplement { protected InterfaceThatJustJoeCanImplement() { if (!"impl.joe.JoesImpl".equals(getClass().getName())) { - throw new IllegalStateException( - "Sorry, you are not allowed to implement this class" - ); + throw new IllegalStateException("Sorry, you are not allowed to implement this class"); } } diff -r eb6f29070331 -r b5cbb797ec0a samples/friendpackage/src/apipkg/Item.java --- a/samples/friendpackage/src/apipkg/Item.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/friendpackage/src/apipkg/Item.java Sat Jun 14 09:58:08 2008 +0200 @@ -1,3 +1,16 @@ +/* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Jaroslav Tulach. Portions Copyright 2007 Jaroslav Tulach. + * All Rights Reserved. + */ + package apipkg; import implpkg.Accessor; @@ -23,8 +36,7 @@ Item() { } - /** Anyone can value of the item. At least if it - * can get a reference to it. + /** Anyone can value of the item. At least if it can get a reference to it. */ public void setValue(int x) { value = x; diff -r eb6f29070331 -r b5cbb797ec0a samples/friendpackage/src/implpkg/Accessor.java --- a/samples/friendpackage/src/implpkg/Accessor.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/friendpackage/src/implpkg/Accessor.java Sat Jun 14 09:58:08 2008 +0200 @@ -30,9 +30,7 @@ } try { - Class.forName( - Item.class.getName(), true, Item.class.getClassLoader() - ); + Class.forName(Item.class.getName(), true, Item.class.getClassLoader()); } catch (Exception ex) { ex.printStackTrace(); } diff -r eb6f29070331 -r b5cbb797ec0a samples/gc/src/org/apidesign/gc/WeakListeners.java --- a/samples/gc/src/org/apidesign/gc/WeakListeners.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/gc/src/org/apidesign/gc/WeakListeners.java Sat Jun 14 09:58:08 2008 +0200 @@ -6,12 +6,8 @@ private WeakListeners() { } // BEGIN: gc.weaklistener.create - public static T create( - Class type, T listener, Object source - ) { - return org.openide.util.WeakListeners.create( - type, listener, source - ); + public static T create(Class type, T listener, Object source) { + return org.openide.util.WeakListeners.create(type, listener, source); } // END: gc.weaklistener.create } diff -r eb6f29070331 -r b5cbb797ec0a samples/gc/test/org/apidesign/gc/SizeTest.java --- a/samples/gc/test/org/apidesign/gc/SizeTest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/gc/test/org/apidesign/gc/SizeTest.java Sat Jun 14 09:58:08 2008 +0200 @@ -12,18 +12,14 @@ public void measureIsDataLowerThan8No() { Data d = new Data(); - NbTestCase.assertSize( - "The size of the data instance is higher than 8, fail", 8, d - ); + NbTestCase.assertSize("The size of the data instance is higher than 8, fail", 8, d); } @Test public void measureIsDataLowerThan16Yes() { // BEGIN: size.measure Data d = new Data(); - NbTestCase.assertSize( - "The size of the data instance is higher than 16", 16, d - ); + NbTestCase.assertSize("The size of the data instance is higher than 16", 16, d); // END: size.measure } diff -r eb6f29070331 -r b5cbb797ec0a samples/growingparameters/src-api2.0/api/classes/Compute.java --- a/samples/growingparameters/src-api2.0/api/classes/Compute.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/growingparameters/src-api2.0/api/classes/Compute.java Sat Jun 14 09:58:08 2008 +0200 @@ -10,17 +10,14 @@ * @return list of strings to work with * @since 1.0 */ public abstract List getData(); - /** Computes the strings to work with together with their - * associated descriptions. Shall be overriden in subclasses. - * By default delegates to {@link #getData} - * and uses the provided strings as both, the string - * and its description. + /** Computes the strings to work with together with their associated descriptions. + * Shall be overriden in subclasses. By default delegates to {@link #getData} + * and uses the provided strings as both, the string and its description. * * @return name to description pairs to work with * @since 2.0 */ public Map getDataAndDescription() { - LinkedHashMap ret = - new LinkedHashMap(); + LinkedHashMap ret = new LinkedHashMap(); for (String s : getData()) { ret.put(s, s); } diff -r eb6f29070331 -r b5cbb797ec0a samples/hellowithsubclassing/src/org/apidesign/hello/ThreeWaysToUseHello.java --- a/samples/hellowithsubclassing/src/org/apidesign/hello/ThreeWaysToUseHello.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/hellowithsubclassing/src/org/apidesign/hello/ThreeWaysToUseHello.java Sat Jun 14 09:58:08 2008 +0200 @@ -19,10 +19,7 @@ // BEGIN: hello.supercall private static class SuperHello extends Hello { @Override - public void hello() { - super.hello(); - System.out.println("Hello once again"); - } + public void hello() { super.hello(); System.out.println("Hello once again"); } } // END: hello.supercall diff -r eb6f29070331 -r b5cbb797ec0a samples/insertsuperclass/src-api2.0/api/HelloClass.java --- a/samples/insertsuperclass/src-api2.0/api/HelloClass.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/insertsuperclass/src-api2.0/api/HelloClass.java Sat Jun 14 09:58:08 2008 +0200 @@ -2,6 +2,6 @@ // BEGIN: design.insert.superclass2 public abstract class HelloClass extends SimpleHelloClass { -// FINISH: design.insert.superclass2 +// END: design.insert.superclass2 public abstract String sayHelloTo(String who); } diff -r eb6f29070331 -r b5cbb797ec0a samples/javabeans/src/org/apidesign/javabeans/toomany/HighlightsContainer.java --- a/samples/javabeans/src/org/apidesign/javabeans/toomany/HighlightsContainer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/javabeans/src/org/apidesign/javabeans/toomany/HighlightsContainer.java Sat Jun 14 09:58:08 2008 +0200 @@ -4,9 +4,8 @@ public interface HighlightsContainer { // BEGIN: javabeans.with.HighlightsContainer.TooMany - public void addHighlightsChangeListener(HighlightsChangeListener l) - throws TooManyListenersException; + public void addHighlightsChangeListener(HighlightsChangeListener listener) throws TooManyListenersException; // END: javabeans.with.HighlightsContainer.TooMany public HighlightsSequence getHighlights(int startOffset, int endOffset); - public void removeHighlightsChangeListener(HighlightsChangeListener l); + public void removeHighlightsChangeListener(HighlightsChangeListener listener); } diff -r eb6f29070331 -r b5cbb797ec0a samples/javabeans/src/org/apidesign/javabeans/with/HighlightsContainer.java --- a/samples/javabeans/src/org/apidesign/javabeans/with/HighlightsContainer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/javabeans/src/org/apidesign/javabeans/with/HighlightsContainer.java Sat Jun 14 09:58:08 2008 +0200 @@ -2,8 +2,8 @@ // BEGIN: javabeans.with.HighlightsContainer public interface HighlightsContainer { - public void addHighlightsChangeListener(HighlightsChangeListener l); - public HighlightsSequence getHighlights(int start, int end); - public void removeHighlightsChangeListener(HighlightsChangeListener l); + public void addHighlightsChangeListener(HighlightsChangeListener listener); + public HighlightsSequence getHighlights(int startOffset, int endOffset); + public void removeHighlightsChangeListener(HighlightsChangeListener listener); } // END: javabeans.with.HighlightsContainer diff -r eb6f29070331 -r b5cbb797ec0a samples/javabeans/src/org/apidesign/javabeans/without/HighlightsContainer.java --- a/samples/javabeans/src/org/apidesign/javabeans/without/HighlightsContainer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/javabeans/src/org/apidesign/javabeans/without/HighlightsContainer.java Sat Jun 14 09:58:08 2008 +0200 @@ -3,7 +3,7 @@ // BEGIN: javabeans.without public interface HighlightsContainer { public void initialize(Callback callback); - public HighlightsSequence getHighlights(int start, int end); + public HighlightsSequence getHighlights(int startOffset, int endOffset); public static final class Callback { Callback() { /* only for the infastructure */ } diff -r eb6f29070331 -r b5cbb797ec0a samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java --- a/samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/javabeans/test/org/apidesign/javabeans/use/toomany/MyHighlightsContainer.java Sat Jun 14 09:58:08 2008 +0200 @@ -11,19 +11,15 @@ final class MyHighlightsContainer implements HighlightsContainer { private HighlightsChangeListener listener; - public synchronized void addHighlightsChangeListener( - HighlightsChangeListener l - ) throws TooManyListenersException { + public synchronized void addHighlightsChangeListener(HighlightsChangeListener l) throws TooManyListenersException { if (listener != null) throw new TooManyListenersException(); listener = l; } - public synchronized void removeHighlightsChangeListener( - HighlightsChangeListener l - ) { + public synchronized void removeHighlightsChangeListener(HighlightsChangeListener l) { if (listener == l) listener = null; } - public HighlightsSequence getHighlights(int start, int end) { + public HighlightsSequence getHighlights(int startOffset, int endOffset) { return null; // implement } -} // END: javabeans.with.MyHighlightsContainer +} \ No newline at end of file diff -r eb6f29070331 -r b5cbb797ec0a samples/libs/build.xml --- a/samples/libs/build.xml Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/libs/build.xml Sat Jun 14 09:58:08 2008 +0200 @@ -1,6 +1,10 @@ - + + + + + @@ -11,11 +15,6 @@ - - - - - diff -r eb6f29070331 -r b5cbb797ec0a samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java --- a/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java Sat Jun 14 09:58:08 2008 +0200 @@ -1,3 +1,8 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + package org.apidesign.impl.security.extension; import java.nio.ByteBuffer; @@ -13,8 +18,7 @@ */ // BEGIN: day.end.bridges.BridgeToNew public class BridgeToNew extends Digestor { - /** initializes the other bridge, and allow us to eliminate stack - * overflow */ + /** initializes the other bridge, and allow us to eliminate stack overflow */ private static final BridgeToOld oldBridge = new BridgeToOld(); @Override @@ -30,9 +34,7 @@ try { return MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException ex) { - Logger.getLogger(BridgeToNew.class.getName()).log( - Level.FINE, "Cannot find " + algorithm, ex - ); + Logger.getLogger(BridgeToNew.class.getName()).log(Level.FINE, "Cannot find " + algorithm, ex); return null; } } diff -r eb6f29070331 -r b5cbb797ec0a samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOld.java --- a/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOld.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOld.java Sat Jun 14 09:58:08 2008 +0200 @@ -1,3 +1,8 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + package org.apidesign.impl.security.extension; import org.apidesign.api.security.Digest; @@ -36,10 +41,7 @@ if ("MessageDigest".equals(type)) { Digest dig = Digest.getInstance(algorithm); if (dig != null) { - return new ServiceImpl( - dig, this, type, algorithm, "", - Collections.emptyList(), - Collections.emptyMap()); + return new ServiceImpl(dig, this, type, algorithm, "", Collections.emptyList(), Collections.emptyMap()); } } return null; @@ -52,19 +54,13 @@ private static class ServiceImpl extends Service { Digest dig; - public ServiceImpl(Digest dig, Provider provider, - String type, String algorithm, String className, - List aliases, Map attributes - ) { - super( - provider, type, algorithm, className, aliases, attributes - ); + public ServiceImpl(Digest dig, Provider provider, String type, String algorithm, String className, List aliases, Map attributes) { + super(provider, type, algorithm, className, aliases, attributes); this.dig = dig; } @Override - public Object newInstance(Object constructorParameter) - throws NoSuchAlgorithmException { + public Object newInstance(Object constructorParameter) throws NoSuchAlgorithmException { return new MessageDigest(getAlgorithm()) { private byte[] res; @@ -75,9 +71,7 @@ } @Override - protected void engineUpdate( - byte[] input, int offset, int len - ) { + protected void engineUpdate(byte[] input, int offset, int len) { ByteBuffer bb = ByteBuffer.wrap(input); bb.position(offset); bb.limit(offset + len); diff -r eb6f29070331 -r b5cbb797ec0a samples/messagedigest/src-new-api/org/apidesign/api/security/Digest.java --- a/samples/messagedigest/src-new-api/org/apidesign/api/security/Digest.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/messagedigest/src-new-api/org/apidesign/api/security/Digest.java Sat Jun 14 09:58:08 2008 +0200 @@ -23,9 +23,7 @@ */ public static Digest getInstance(String algorithm) { for (Digestor digestor : ServiceLoader.load(Digestor.class)) { - DigestImplementation impl = DigestImplementation.create( - digestor, algorithm - ); + DigestImplementation impl = DigestImplementation.create(digestor, algorithm); if (impl != null) { return new Digest(impl); } diff -r eb6f29070331 -r b5cbb797ec0a samples/messagedigest/src-new-api/org/apidesign/spi/security/Digestor.java --- a/samples/messagedigest/src-new-api/org/apidesign/spi/security/Digestor.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/messagedigest/src-new-api/org/apidesign/spi/security/Digestor.java Sat Jun 14 09:58:08 2008 +0200 @@ -17,7 +17,7 @@ protected abstract Data create(String algorithm); protected abstract void update(Data data, ByteBuffer input); -// FINISH: day.end.bridges.Digestor +// END: day.end.bridges.Digestor static { diff -r eb6f29070331 -r b5cbb797ec0a samples/messagedigest/src-test/test/CountingDigestor.java --- a/samples/messagedigest/src-test/test/CountingDigestor.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/messagedigest/src-test/test/CountingDigestor.java Sat Jun 14 09:58:08 2008 +0200 @@ -17,12 +17,7 @@ @Override protected byte[] digest(int[] data) { int i = data[0]; - byte[] arr = { - (byte) (i & 255), - (byte) ((i >> 8) & 255), - (byte) ((i >> 16) & 255), - (byte) ((i >> 24) & 255) - }; + byte[] arr = { (byte) (i & 255), (byte) ((i >> 8) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 24) & 255) }; return arr; } diff -r eb6f29070331 -r b5cbb797ec0a samples/misuse/src/org/apidesign/misuse/projectconfig/ProjectConfigurationCorrect.java --- a/samples/misuse/src/org/apidesign/misuse/projectconfig/ProjectConfigurationCorrect.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/misuse/src/org/apidesign/misuse/projectconfig/ProjectConfigurationCorrect.java Sat Jun 14 09:58:08 2008 +0200 @@ -2,8 +2,7 @@ public class ProjectConfigurationCorrect { // BEGIN: misuse.prjconfig.correct - interface ProjectConfigurationProvider - { + interface ProjectConfigurationProvider { Configuration[] getConfigurations(); Configuration getActive(); void setActive(Configuration c); @@ -18,7 +17,7 @@ /* Following does not work: static { // BEGIN: misuse.prjconfig.correct.trivial.access - ProjectConfigurationProvider provider = null; // obtain elsewhere; + ProjectConfigurationProvider provider = null; // obtain from somewhere; provider.setActive(provider.getConfigurations()[0]); // END: misuse.prjconfig.correct.trivial.access } @@ -26,7 +25,7 @@ static { // BEGIN: misuse.prjconfig.correct.access - ProjectConfigurationProvider provider = null; // obtain elsewhere; + ProjectConfigurationProvider provider = null; // obtain from somewhere; resetToZero(provider); // END: misuse.prjconfig.correct.access } @@ -40,9 +39,7 @@ // END: misuse.prjconfig.correct.openmethod // BEGIN: misuse.prjconfig.correct.openclass - static void workWithProjectConfigurationProvider( - ProjectConfigurationProvider p - ) { + static void workWithProjectConfigurationProvider(ProjectConfigurationProvider p) { ResetToZero rtz = ResetToZero.create(p); rtz.obtainFirst(); // after a while @@ -57,9 +54,7 @@ this.provider = provider; } - static ResetToZero create( - ProjectConfigurationProvider p - ) { + static ResetToZero create(ProjectConfigurationProvider p) { return new ResetToZero(p); } diff -r eb6f29070331 -r b5cbb797ec0a samples/preventcyclicdependencies/src-acyclic1/org/apidesign/cycles/array/MutableArray.java --- a/samples/preventcyclicdependencies/src-acyclic1/org/apidesign/cycles/array/MutableArray.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/preventcyclicdependencies/src-acyclic1/org/apidesign/cycles/array/MutableArray.java Sat Jun 14 09:58:08 2008 +0200 @@ -17,7 +17,7 @@ public void encrypt(OutputStream os) throws IOException { DoEncode en = Lookup.getDefault().lookup(DoEncode.class); - assert en != null : "org.netbeans.example.crypt missing!"; + assert en != null : "We need org.netbeans.example.crypt to be enabled!"; byte[] clone = (byte[]) arr.clone(); en.encode(clone); os.write(clone); diff -r eb6f29070331 -r b5cbb797ec0a samples/primitiveconstants/src-impl/impl/Impl.java --- a/samples/primitiveconstants/src-impl/impl/Impl.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/primitiveconstants/src-impl/impl/Impl.java Sat Jun 14 09:58:08 2008 +0200 @@ -5,10 +5,10 @@ public class Impl extends API { protected void init(int version) throws IllegalStateException { if (version != API.VERSION) { - throw new IllegalStateException("Wrong API version error!"); + throw new IllegalStateException("Not the right API version error!"); } } -// FINISH: theory.binary.constants.impl +// END: theory.binary.constants.impl public static void main(String[] args) { System.err.println("main expects version: " + API.VERSION); diff -r eb6f29070331 -r b5cbb797ec0a samples/privilegedcreator/test/accessprotectedmethod/MyDocument.java --- a/samples/privilegedcreator/test/accessprotectedmethod/MyDocument.java Sat Jun 14 09:58:05 2008 +0200 +++ b/samples/privilegedcreator/test/accessprotectedmethod/MyDocument.java Sat Jun 14 09:58:08 2008 +0200 @@ -11,7 +11,7 @@ final void writeLockAccess() { writeLock(); } -// FINISH: public.accessor +// END: public.accessor @Override public Element getDefaultRootElement() {