../../bin/nitpick -q tests/many.nit
bin/jwrapper -v -u comment -o tests/wildcards.nit tests/wildcards.javap
../../bin/nitpick -q tests/wildcards.nit
+ make -C examples/queue/ check
check-libs: bin/jwrapper
# This config dependent rule must be tweaked according to each system
--- /dev/null
+# Nit test program
+user_test: queue.nit $(shell ../../../../bin/nitls -M user_test.nit) ../../../../bin/nitc
+ CLASSPATH=`pwd` ../../../../bin/nitc user_test.nit
+
+ # Manually add our class file to the Jar for easy access
+ jar -uf user_test.jar Queue.class
+
+# Compiled Java class
+Queue.class: Queue.java
+ javac Queue.java
+
+# The Nit wrapper to the Java class
+queue.nit: Queue.class
+ ../../bin/jwrapper Queue.class -o queue.nit -p "Java" -i auto
+
+# Test
+check: user_test
+ # Execute test
+ ./user_test > user_test.res
+
+ # Compare the result with the expected
+ diff user_test.sav user_test.res
--- /dev/null
+/*
+* This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/
+
+import java.util.*;
+
+public class Queue
+{
+ // function pointer
+ public native void printError( String errorMsg );
+
+ // internal list
+ private LinkedList<String> list;
+
+ public Queue()
+ {
+ list = new LinkedList<String>();
+ }
+
+ public void push( String element )
+ {
+ System.out.print( "From java, pushing " );
+ System.out.print( element );
+ System.out.print( "\n" );
+ list.addLast( element );
+ }
+
+ public String pop() // knows where is native printError
+ {
+ String element;
+
+ try
+ {
+ element = list.removeFirst();
+ }
+ catch ( NoSuchElementException e )
+ {
+ printError( "From java, empty queue." );
+ element = null;
+ throw e;
+ }
+
+ System.out.print( "From java, popping " );
+ System.out.print( element );
+ System.out.print( "\n" );
+
+ return element;
+ }
+}
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import queue
+
+var queue = new JavaQueue
+queue.push "one".to_java_string
+queue.push "two".to_java_string
+queue.push "tree".to_java_string
+print queue.pop
+print queue.pop
+print queue.pop