Wild import
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:56:58 +0200
changeset 136324d01de8a3a
parent 135 6a66df28018c
child 137 a6ae66ce006d
Wild import
samples/incompatibilities/build.xml
samples/incompatibilities/nbproject/project.xml
samples/incompatibilities/src-io/org/apidesign/wrapio/WrappingIOException.java
samples/incompatibilities/src-wildimport/org/apidesign/wildimport/VList.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/incompatibilities/build.xml	Sat Jun 14 09:56:58 2008 +0200
     1.3 @@ -0,0 +1,36 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project name="incompatibilities" default="run" basedir=".">
     1.6 +    <target name="clean">
     1.7 +        <delete dir="build"/>
     1.8 +    </target>
     1.9 +    
    1.10 +    <target name="compile" depends="build"/>
    1.11 +    <target name="build" depends="clean">
    1.12 +        <echo level="info" message="Compiles correctly with JDK 1.5, and also 1.3, but that is hard to demonstrate"/>
    1.13 +        <antcall target="-build-one">
    1.14 +            <param name="version" value="io"/>
    1.15 +            <param name="source" value="1.5"/>
    1.16 +        </antcall>
    1.17 +        <echo level="info" message="Does not compile in 1.4 mode"/>
    1.18 +        <antcall target="-build-one">
    1.19 +            <param name="version" value="io"/>
    1.20 +            <param name="source" value="1.4"/>
    1.21 +        </antcall>
    1.22 +    </target>
    1.23 +    
    1.24 +    <!-- support methods -->
    1.25 +    
    1.26 +    <target name="-build-one">
    1.27 +        <fail message="You need to specify version number" unless="version"/>
    1.28 +        <fail message="You need to specify source number" unless="source"/>
    1.29 +        
    1.30 +        <property name="target" value="${source}"/>
    1.31 +        <mkdir dir="build/${target}/classes"/>
    1.32 +        <javac 
    1.33 +            srcdir="src-io" 
    1.34 +            destdir="build/${target}/classes" 
    1.35 +            source="${source}" target="${source}"
    1.36 +            classpath="${cp}"
    1.37 +        />
    1.38 +    </target>
    1.39 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/samples/incompatibilities/nbproject/project.xml	Sat Jun 14 09:56:58 2008 +0200
     2.3 @@ -0,0 +1,71 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<project xmlns="http://www.netbeans.org/ns/project/1" xmlns:ns4="null">
     2.6 +    <type>org.netbeans.modules.ant.freeform</type>
     2.7 +    <configuration>
     2.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     2.9 +            <name>incompatibilities</name>
    2.10 +        </general-data>
    2.11 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
    2.12 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    2.13 +            <name>incompatibilities</name>
    2.14 +            <properties/>
    2.15 +            <folders>
    2.16 +                <source-folder>
    2.17 +                    <label>src-io</label>
    2.18 +                    <type>java</type>
    2.19 +                    <location>src-io</location>
    2.20 +                    <encoding>UTF-8</encoding>
    2.21 +                </source-folder>
    2.22 +                <source-folder>
    2.23 +                    <label>src-wildimport</label>
    2.24 +                    <type>java</type>
    2.25 +                    <location>src-wildimport</location>
    2.26 +                    <encoding>UTF-8</encoding>
    2.27 +                </source-folder>
    2.28 +            </folders>
    2.29 +            <ide-actions>
    2.30 +                <action name="build">
    2.31 +                    <target>build</target>
    2.32 +                </action>
    2.33 +                <action name="clean">
    2.34 +                    <target>clean</target>
    2.35 +                </action>
    2.36 +                <action name="run">
    2.37 +                    <target>run</target>
    2.38 +                </action>
    2.39 +                <action name="rebuild">
    2.40 +                    <target>clean</target>
    2.41 +                    <target>build</target>
    2.42 +                </action>
    2.43 +            </ide-actions>
    2.44 +            <view>
    2.45 +                <items>
    2.46 +                    <source-folder style="packages">
    2.47 +                        <label>Wrapping I/O Exception</label>
    2.48 +                        <location>src-io</location>
    2.49 +                    </source-folder>
    2.50 +                    <source-folder style="packages">
    2.51 +                        <label>Uncompilable Code since JDK 1.2</label>
    2.52 +                        <location>src-wildimport</location>
    2.53 +                    </source-folder>
    2.54 +                </items>
    2.55 +                <context-menu>
    2.56 +                    <ide-action name="build"/>
    2.57 +                    <ide-action name="rebuild"/>
    2.58 +                    <ide-action name="clean"/>
    2.59 +                    <ide-action name="run"/>
    2.60 +                </context-menu>
    2.61 +            </view>
    2.62 +        </general-data>
    2.63 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    2.64 +            <compilation-unit>
    2.65 +                <package-root>src-io</package-root>
    2.66 +                <source-level>1.5</source-level>
    2.67 +            </compilation-unit>
    2.68 +            <compilation-unit>
    2.69 +                <package-root>src-wildimport</package-root>
    2.70 +                <source-level>1.3</source-level>
    2.71 +            </compilation-unit>
    2.72 +        </java-data>
    2.73 +    </configuration>
    2.74 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/samples/incompatibilities/src-io/org/apidesign/wrapio/WrappingIOException.java	Sat Jun 14 09:56:58 2008 +0200
     3.3 @@ -0,0 +1,15 @@
     3.4 +package org.apidesign.wrapio;
     3.5 +
     3.6 +import java.io.IOException;
     3.7 +
     3.8 +// BEGIN: wrapping.WrappingIOException
     3.9 +public class WrappingIOException extends IOException {
    3.10 +  private IOException cause;
    3.11 +  public WrappingIOException(IOException cause) {
    3.12 +    this.cause = cause;
    3.13 +  }
    3.14 +  public IOException getCause() {
    3.15 +    return cause;
    3.16 +  }
    3.17 +}
    3.18 +// END: wrapping.WrappingIOException
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/samples/incompatibilities/src-wildimport/org/apidesign/wildimport/VList.java	Sat Jun 14 09:56:58 2008 +0200
     4.3 @@ -0,0 +1,11 @@
     4.4 +package org.apidesign.wrapio;
     4.5 +
     4.6 +// BEGIN: theory.wildimport
     4.7 +import java.awt.*;
     4.8 +import java.util.*;
     4.9 +
    4.10 +/** Could be compiled on JDK 1.2, before java.util.List was created */
    4.11 +public class VList extends List {
    4.12 +    Vector v;
    4.13 +}        
    4.14 +// END: theory.wildimport