Fixes removeFirst() and removeLast() incompatibilities with methods
of the same name in the Java base class java.util.AbstractSequentialList
which were added in JDK 21 as part of JEP-431.
configure.ac has been modified to detect the version of JDK/Java for use
in testing the test-suite via the JAVA_VERSION_MAJOR variable.
Needed to continue testing removeFirst(), removeLast(), addFirst(), addLast().
Closes#3156
Fixes:
[cast] redundant cast
[rawtypes] found raw type
[serial] serializable class has no definition of serialVersionUID
Also suppress warning: auxiliary class TargetLanguageBase in ./inherit_target_language.java should not be accessed from outside its own source file
For example:
%typemap(in) int MYINT (int $1_temp) { ... }
$1_temp is typically expanded to arg1_temp, arg2_temp etc depending on
which argument the typemap is applied to.
Fix incorrect variable setters being generated when wrapping
reference member variables. A setter is no longer generated if the
type of the reference member variable is non-assignable.
Fixes#2866
The appropriate namespace for friends declared in a class/template were
not always being correctly determined when %template is used in nested
hierarchies. Further improvements to previous commit.
We need to modify the scope that friends are declared in to the
namespace that of the outermost class is declared in. The friend is
not declared within a class, it must be a namespace. Add missing
implementations of the "prev_symtab" so that it is set in every
class and then use this for picking up the appropriate scope for
declaring the friend in.
Closes#2845
Many of the target languages don't handle this currently. Those
that don't support this in their strings never will, but others
can probably be fixed.
Fixes#2996Fixes#2997
Also remove stray static method comments from being incorrectly
generated into the PINVOKE class.
Add some missing multi-line tests for static methods, variables and
constants.
Use $(ECHO_PROGRESS) instead of the hard-coded "echo" to allow setting
ECHO_PROGRESS=: on make command line to suppress the (many hundreds of)
messages given when running every unit test.
This makes it much easier to see any warnings given during the test
suite execution.
* char_binary_java_fix-tidyup:
Move SWIGStringWithLengthHelper to csharphead.swg
cdata whitespace/cosmetic fixups
cdata doc updates
Rename `typemaps/cdata_struct.swg` to `typemaps/cdata_begin.swg`. And `typemaps/cdata.swg` to `typemaps/cdata.swg`. Move `cdata_apply.swg` content to `typemaps/cdata.swg`.
Group the C# marshalling of STRING-LENGTH typemap into C# class named SWIGStringWithLengthHelper.
Leave Length & string reverse order typemap in typemaps/strings.swg
Support old C# as "LPUTF8Str" was add in 2017.
Improve documentation. Follow @wsfulton reviews.
Use a dummy for MzScheme and untested OCaml cdate. To prevent compilation error.
Further fixing follow reviews.
Reorganise raw data typemap, so typemaps folder contain only common part. Improve document.
Inline SWIG_string_to_utf8_bytes SWIG_utf8_bytes_to_string code
Fixes of STRING/BYTES LENGTH typemaps.
Conflicts:
CHANGES.current
* fix_2872:
Rename internal flag to fvirtual:ignore
Whitespace corrections
Adding virtual destructors.
Adding test case for #2872.
add_member_for_using_declaration now ignore's the feature:ignore flag if it was set by fvirtual. This fixes#2872.
Conflicts:
CHANGES.current
Closes#2872Closes#2873
Java's nested iterator class in std::map, std::set, std::unordered_map,
std::unordered_set needs to be public instead of protected for
access to work when moving STL types into different Java packages.
For example:
%nspace Space::OuterClass80;
namespace Space {
struct OuterClass80 {
struct InnerClass80 {
struct BottomClass80 {};
};
enum InnerEnum80 { ie80a, ie80b };
};
}
Previously the following were additionally required for some languages:
%nspace Space::OuterClass80::InnerClass80;
%nspace Space::OuterClass80::InnerClass80::Bottom80;
Now the appropriate nspace setting is taken from the outer class.
A new warning has also been introduced to check and correct conflicting
nspace usage, for example if the following is additionally added:
%nspacemove(AnotherSpace) Space::OuterClass80::InnerClass80;
The following warning appears as an inner class can't be moved outside
of the outer class:
Warning 406: Ignoring nspace setting (AnotherSpace) for 'Space::OuterClass80::InnerClass80',
Warning 406: as it conflicts with the nspace setting (Space) for outer class 'Space::OuterClass80'.
This really helps with %nspacemove as now one can simply move an outer
class to another namespace, like this:
%nspacemove(AnotherSpace) Space::OuterClass80;
and all the nested classes will automatically also be moved
into the appropriate namespace.
%nspacemove moves a class or enum into a different target language 'namespace'.
This builds on top of %nspace and so is currently only implemented in
C#, D, Java, Javascript and Lua.
Javascript also supports %nspace for functions and variables in a
namespace with a non-standard implementation; %nspacemove is not
fully working yet for Javascript.
Issue #2782
instead of copy constructor when passing movable types by value.
Additional enhancement when passing movable types to constructors.
Enhancement to e777b054d5.
instead of copy constructor when passing movable types. This was
previously implemented only for parameters passed to a global function
or static member function and is now extended to member methods.
Enhancement to e777b054d5.
These need to be addressed, but meanwhile it makes running the testsuite
with OpenJDK 21 or newer unhelpfully noisy so suppressing it seems more
helpful than not.
Closes: #2819
Fix Java STRING LENGTH typemap.
Use string type in static typed languages (Java, C#, D and Go).
Add BYTES LENGTH typemap and apply it for binary data.
Use byte type in static typed languages.
Add li_cdata_cpp, li_cdata and char_binary
tests for most of languages(apart from R and experimental).
Fix the director_binary_string test and add it to C#, D, Go,
Perl, PHP, Python, Ruby and octave.
Update documents.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
Fix compilation errors in generated code when instantiating a templated
static method within a template (non-static methods and constructors were
always okay). For example:
template <typename T> class X {
template <class InputIterator>
static void fn(InputIterator first, InputIterator last) { ... }
};
class SimpleIterator { ... };
%extend X<int> {
%template(fn) fn<SimpleIterator>;
}
The problem being fixed here is an extended method was generated when it
should not have been as for other %template instantiations within a
template - the template can be called directly.
Test includes variadic static method templates in a template, including
method overloading..
A different approach is taken for supporting casting smart pointers up the
inheritance hierarchy. We no longer try to replace the underlying pointer type,
provided in the 'feature:smartptr', with the base class type. Such as morphing
'std::shared_ptr<(Derived)>' into 'std::shared_ptr<(Base)>'. Instead, we simply
use 'feature:smartptr' from the base class. This is more reliable than trying to
pattern match the pointer type in the feature. The base class must of course
also have the 'feature:smartptr' set, and this is still checked for as before.
The feature is now parsed in one place and stored in the parse tree in the
new 'smart' attribute for handling by the target languages.
Fix also improves the handling of the type parsed in 'feature:smartptr' in that
the type is now normalized and resolved in the scope of the class it is attached
to.
Closes#2768
With Perl the returned string is still being corrupted (the testcase
flags this as "TODO" for Perl's test harness).
Warnings aren't currently emitted for Perl, Ruby or Tcl as I'm not
seeing where in the UTL maze the directorout typemap actually gets
defined.
Adjust the floating point constants to be 1.125 and 2.25 (which
can be exactly represented in base-2 floating point) instead of
1.1 and 2.2 (which can't). This avoids problems on platforms where
floating point calculations suffer from excess precision, the most
commonly used of which is x86 when using 387 FP instructions.
In $typemap(), the $n special variables are replaced by the appropriate
value for the type associated with the typemap calling $typemap().
The (undocumented) special variable overrides now also support
controlling what the $n special variables are replaced with from the
calling typemap, for example:
%typemap(in) std::pair<std::string, int> {
int& input_value_second = $1.second;
$typemap(in, int, 1=input_value_second);
...
}
replaces $1 in the int typemap with input_value_second instead of
whatever is the default for the target language (a variable that holds
the int value after marshalling from the target language).
This additional functionality might make it possible to replace the C++
templates used in the UTL with a much simpler system of typemaps utilising
$typemap(). See follow on commit to typemaps.c.
more than two deep and the using declarations are overloaded.
Using declarations from a base class' base were not available for use
in the target language when the using declaration was before a method
declaration.
Closes#2687
Defining SWIGWORDSIZE64 now applies the (unsigned) long long
typemaps to (unsigned) long for a better match on systems
where long is 64-bits.
Although size_t typemaps are now applied from the int typemaps instead
of the long typemaps, identical code is generated and the mapping is
still to the Java signed long type.
Closes#646Closes#649
Running the test-suite as follows on a 64-bit long system:
env SWIG_FEATURES=-DSWIGWORDSIZE64 make check-java-test-suite
passes, except for a few tests which fail where they expect the
default Java type to be int or long instead of long or BigInteger
respectively.
Also arrays_java.i results in:
invalid conversion from ‘long int*’ to ‘long long int*’ [-fpermissive]
invalid conversion from ‘long int**’ to ‘long long int**’ [-fpermissive]