Skip to content

Commit

Permalink
Patch version 6.3.3
Browse files Browse the repository at this point in the history
Bugfix Issue #60
Bugfix Issue #62
Bugfix Issue #63
Bugfix Issue #64
Bugfix Issue #66
Bugfix Issue #69
  • Loading branch information
omix committed Aug 19, 2022
1 parent 28dd00b commit ece6eba
Show file tree
Hide file tree
Showing 212 changed files with 10,639 additions and 7,237 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ Make yourself familiar with [developing applications with QtJambi](www/How-to-de

### Requirements
* [Apache Ant](https://ant.apache.org/) (min. 1.10.x)
* Java Development Kit (e.g. [OpenJDK](https://adoptopenjdk.net/), tested with Java 1.8 and 14)
* Java Development Kit (e.g. [OpenJDK](https://adoptopenjdk.net/), tested with Java 1.8 and 18)
* Qt 5.15 or 6.x (using the Qt Online Installer)
* C++ compiler (Gcc, Clang, MSVC2019)
* chrpath (Linux only)
* XCode command line tools (macOS only)

### Building QtJambi
If you do'n need the entire set of Qt modules available in Java edit property `qtjambi.skipped.modules` in `build.properties` and exclude Qt modules you don't need.
If you do'nt need the entire set of Qt modules available in Java edit property `qtjambi.skipped.modules` in `build.properties` and exclude Qt modules you don't need.
This saves compilation time.

#### Pre-Build Steps On Windows
Expand Down Expand Up @@ -100,7 +100,7 @@ to your project:
<version>$VERSION</version>
</dependency>
```
(exchange `$VERSION` either by `5.15.7`, `6.2.5` or by `6.3.2`).
(exchange `$VERSION` either by `5.15.8`, `6.2.6` or by `6.3.3`).

Otherwise, download QtJambi JAR file from [Maven Central Repository](https://search.maven.org/artifact/io.qtjambi/qtjambi/).

Expand All @@ -120,7 +120,7 @@ public class Test {
Compile the file:

``` powershell
javac -cp qtjambi-6.3.2.jar Test.java
javac -cp qtjambi-6.3.3.jar Test.java
```

### Execute Example
Expand All @@ -135,7 +135,7 @@ Therefore, use the PATH environment (LD_LIBRARY_PATH on Linux, DYLD_LIBRARY_PATH
or the Java runtime property java.library.path. The example program can be executed this way:

```
java -cp qtjambi-6.3.2.jar;. -Djava.library.path=C:\Qt\6.3.1\msvc2019_64\bin Test
java -cp qtjambi-6.3.3.jar;. -Djava.library.path=C:\Qt\6.3.1\msvc2019_64\bin Test
```

(On macOS you additionally need to use the start parameter -XstartOnFirstThread)
Expand Down
1 change: 1 addition & 0 deletions antfiles/generator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<xmlmerge victim="pdfwidgets"/>
<xmlmerge victim="activex"/>
<xmlmerge victim="ui4"/>
<xmlmerge victim="httpserver"/>
</target>

</project>
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
qtjambi.generator=system-qt
generator.includepaths=${basedir}/generator/targets;${basedir}/src/cpp;${java.home.target}/include;${java.home.target}/include/${java.osarch.target};
qtjambi.private.modules=QtCore,QtGui,QtRemoteObjects,Qt3DCore,QtDesigner
#qtjambi.private.modules=QtCore,QtGui,QtRemoteObjects,Qt3DCore,QtDesigner
qtjambi.debug-tools=false
qtjambi.debug.trace=false
qtjambi.user.name=docjambi
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Further options:
description="Compiles and bundles the Qt Jambi plugins.">
<foreach-version targets="plugins-impl"/>
</target>
<target name="plugins-impl" depends="log, setenv, init.taskdef, init.build, javac.excludes, java.build.qtjambiplugins, library.native.bundle.plugins-impl"/>
<target name="plugins-impl" depends="init.build, javac.excludes, java.build.qtjambiplugins, library.native.bundle.plugins-impl"/>

<target name="library" depends="log, setenv, init.taskdef"
description="Compiles and bundles the Qt Jambi libraries.">
Expand Down
311 changes: 249 additions & 62 deletions generator/abstractmetabuilder.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions generator/abstractmetabuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class AbstractMetaBuilder {
const QMap<QString, QString>* m_features;
QMap<QString,TypeSystemTypeEntry *> m_typeSystemByPackage;
QMap<TypeSystemTypeEntry *,QSet<QString>> m_containerBaseClasses;
QList<AbstractMetaEnum *> m_scopeChangedEnums;
uint m_qtVersionMajor;
uint m_qtVersionMinor;
uint m_qtVersionPatch;
Expand Down
21 changes: 17 additions & 4 deletions generator/abstractmetalang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,12 @@ AbstractMetaEnumValue *AbstractMetaClass::findEnumValue(const QString &enumValue
if (v->cppName() == enumValueName)
return v;
}
if(e->typeEntry()->isScopedEnum()){
for(AbstractMetaEnumValue *v : e->values()) {
if (v->name() == enumValueName)
return v;
}
}
}

if (typeEntry()->isInterface())
Expand Down Expand Up @@ -2815,7 +2821,7 @@ QString AbstractMetaEnumValue::cppName() const {
return m_enum && m_enum->typeEntry()->isScopedEnum() ? m_enum->typeEntry()->name() + "::" + m_name : m_name;
}

static void add_extra_include_for_type(AbstractMetaClass *meta_class, const AbstractMetaType *type) {
void add_extra_include_for_type(AbstractMetaClass *meta_class, const AbstractMetaType *type) {

if (!type)
return;
Expand All @@ -2836,7 +2842,7 @@ static void add_extra_include_for_type(AbstractMetaClass *meta_class, const Abst
}
}

static void add_extra_includes_for_function(AbstractMetaClass *meta_class, const AbstractMetaFunction *meta_function) {
void add_extra_includes_for_function(AbstractMetaClass *meta_class, const AbstractMetaFunction *meta_function) {
Q_ASSERT(meta_class);
Q_ASSERT(meta_function);
add_extra_include_for_type(meta_class, meta_function->type());
Expand Down Expand Up @@ -3003,7 +3009,11 @@ void AbstractMetaClass::fixFunctions(std::function<AbstractMetaArgument*(TypeEnt
}
}

if (!hasNonFinalModifier && !isBaseImplPrivate && f->addedArguments().isEmpty()) {
if (!hasNonFinalModifier
&& !isBaseImplPrivate
&& f->addedArguments().isEmpty()
&& (f->implementingClass()->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang)
&& (sf->implementingClass()->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang)) {
ReportHandler::warning(QString::fromLatin1("Shadowing: %1::%2 and %3::%4; Java code will not compile")
.arg(sf->implementingClass()->qualifiedCppName())
.arg(sf->signature())
Expand Down Expand Up @@ -3206,9 +3216,12 @@ AbstractMetaEnum *AbstractMetaClassList::findEnum(const EnumTypeEntry *entry) co
}

AbstractMetaClass *meta_class = findClass(class_name);
if (!meta_class && !entry->javaScope().isEmpty()) {
meta_class = findClass(entry->javaScope(), FullName);
}
if (!meta_class) {
ReportHandler::warning(QString("Unknown class '%1' for enum '%2'")
.arg(class_name).arg(entry->qualifiedCppName()));
.arg(class_name, entry->qualifiedCppName()));
return nullptr;
}

Expand Down
5 changes: 5 additions & 0 deletions generator/abstractmetalang.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class AbstractMetaType {
ValuePattern,
StringPattern,
Latin1StringPattern,
Latin1StringViewPattern,
StringViewPattern,
AnyStringViewPattern,
Utf8StringViewPattern,
Expand Down Expand Up @@ -342,6 +343,7 @@ class AbstractMetaType {
bool isString() const {
return m_pattern == StringPattern
|| m_pattern == Latin1StringPattern
|| m_pattern == Latin1StringViewPattern
|| m_pattern == StringViewPattern
|| m_pattern == AnyStringViewPattern
|| m_pattern == Utf8StringViewPattern
Expand All @@ -354,6 +356,9 @@ class AbstractMetaType {
// returns true if the type was originally a QLatin1String
bool isTargetLangLatin1String() const { return m_pattern == Latin1StringPattern; }

// returns true if the type was originally a QLatin1StringView
bool isTargetLangLatin1StringView() const { return m_pattern == Latin1StringViewPattern; }

// returns true if the type was originally a QString or const QString & or equivalent for QLatin1String
bool isTargetLangStringView() const { return m_pattern == StringViewPattern; }

Expand Down
37 changes: 33 additions & 4 deletions generator/cppgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ QString CppGenerator::translateType(const AbstractMetaType *java_type, Option op
if (java_type->hasNativeId() && (option & UseNativeIds)){
return "QtJambiNativeID";
}else if (java_type->isPrimitive()
|| java_type->isTargetLangChar()
|| java_type->isTargetLangString()
|| java_type->isTargetLangStringRef()
|| java_type->isVariant()
Expand Down Expand Up @@ -129,6 +130,7 @@ QString CppGenerator::translateType(const AbstractMetaType *java_type, Option op
|| java_type->isTargetLangAnyStringView()
|| java_type->isTargetLangUtf8StringView()
|| java_type->isTargetLangLatin1String()
|| java_type->isTargetLangLatin1StringView()
|| (java_type->typeEntry()->qualifiedTargetLangName()=="java.lang.String" && java_type->indirections().isEmpty())){
return "jstring";
} else {
Expand Down Expand Up @@ -368,8 +370,35 @@ void CppGenerator::writeFunctionArguments(QTextStream &s,
s << "jstring";
else if(!typeReplaced.isEmpty())
s << "jobject";
else
s << translateType(arg->type(), Option(option & ~JNIProxyFunction));
else{
if(java_function->argumentTypeBuffer(arg->argumentIndex() + 1)){
s << "jobject";
}else if(java_function->argumentTypeArray(arg->argumentIndex() + 1)){
if(arg->type()->typeEntry()->isPrimitive()){
if(arg->type()->typeEntry()->targetLangName()=="int"){
s << "jintArray";
}else if(arg->type()->typeEntry()->targetLangName()=="long"){
s << "jlongArray";
}else if(arg->type()->typeEntry()->targetLangName()=="short"){
s << "jshortArray";
}else if(arg->type()->typeEntry()->targetLangName()=="byte"){
s << "jbyteArray";
}else if(arg->type()->typeEntry()->targetLangName()=="boolean"){
s << "jbooleanArray";
}else if(arg->type()->typeEntry()->targetLangName()=="char"){
s << "jcharArray";
}else if(arg->type()->typeEntry()->targetLangName()=="float"){
s << "jfloatArray";
}else if(arg->type()->typeEntry()->targetLangName()=="double"){
s << "jdoubleArray";
}
}else{
s << "jobjectArray";
}
}else{
s << translateType(arg->type(), Option(option & ~JNIProxyFunction));
}
}
if (!(option & SkipName)){
s << " " << arg->indexedName();
}
Expand Down Expand Up @@ -981,8 +1010,8 @@ QString CppGenerator::jni_signature(const AbstractMetaType *java_type, JNISignat
QString name = java_type->name();
if (java_type->isFunctional()) {
const FunctionalTypeEntry *func = static_cast<const FunctionalTypeEntry *>(java_type->typeEntry());
if(!func->qualifier().isEmpty())
name = func->qualifier()+"$"+name;
if(!func->javaQualifier().isEmpty())
name = func->javaQualifier()+"$"+name;
} else if (java_type->isObject() || java_type->isValue()) {
if (const InterfaceTypeEntry *ie
= static_cast<const ImplementorTypeEntry *>(java_type->typeEntry())->designatedInterface())
Expand Down
Loading

0 comments on commit ece6eba

Please sign in to comment.