Skip to content

Commit

Permalink
Merge branch 'apache:master' into js-codegen-use-outputVar
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-harris-5 committed Mar 27, 2024
2 parents 42d97c8 + 9bd1f1b commit 045fe74
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 82 deletions.
65 changes: 65 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@

# Apache Thrift Changelog

## 0.20.0

### Known Open Issues (Blocker or Critical)

- [THRIFT-3877](https://issues.apache.org/jira/browse/THRIFT-3877) - C++ library don't work with HTTP (csharp server, cpp client; need cross test enhancement)
- [THRIFT-5468](https://issues.apache.org/jira/browse/THRIFT-5468) - Swift service generator doesn't support oneway
- [THRIFT-5654](https://issues.apache.org/jira/browse/THRIFT-5654) - LNK4042 and LNK2019 in go_validator_generator.cc

### Build Process

- [THRIFT-5747]https://issues.apache.org/jira/browse/THRIFT-5747 - warning: The macro `AC_HELP_STRING' is obsolete. You should run autoupdate. and some more warnings

### C++

- [THRIFT-5670]https://issues.apache.org/jira/browse/THRIFT-5670 - recvTimeout is not printed correctly for THRIFT_EAGAIN

### Compiler (General)

- [THRIFT-5733]https://issues.apache.org/jira/browse/THRIFT-5733 - Building code with circular `include`s can result in tons of memory usage and eventual segfault

### Delphi

- [THRIFT-5749]https://issues.apache.org/jira/browse/THRIFT-5749 - Option to enable RTTI info
- [THRIFT-5740]https://issues.apache.org/jira/browse/THRIFT-5740 - inherited interfaces should be explicitly listed in Delphi class decl

### Documentation

- [THRIFT-4606]https://issues.apache.org/jira/browse/THRIFT-4606 - LGPL license file still present

### Erlang

- [THRIFT-5635]https://issues.apache.org/jira/browse/THRIFT-5635 - Replace some removed functions with new counterparts

### Go

- [THRIFT-5744]https://issues.apache.org/jira/browse/THRIFT-5744 - Switch to slog for go library
- [THRIFT-5745]https://issues.apache.org/jira/browse/THRIFT-5745 - Implement slog.LogValuer on go TStructs


### Haxe

- [THRIFT-5734]https://issues.apache.org/jira/browse/THRIFT-5734 - generated code may lack required capitalization at class names
- [THRIFT-5742]https://issues.apache.org/jira/browse/THRIFT-5742 - Add addRange() function to Set helpers to support adding data from arbitrary enumerable containers

### Java

- [THRIFT-5738]https://issues.apache.org/jira/browse/THRIFT-5738 - Compiler build fails on Mac

### netstd

- [THRIFT-5746]https://issues.apache.org/jira/browse/THRIFT-5746 - Upgrade to net8
- [THRIFT-5743]https://issues.apache.org/jira/browse/THRIFT-5743 - add TLS1.3 to default protocols where available
- [THRIFT-5726]https://issues.apache.org/jira/browse/THRIFT-5726 - package upgrades and consolidation/improvement of build targets checks

### PHP

- [THRIFT-5752]https://issues.apache.org/jira/browse/THRIFT-5752 - Add TTransportFactoryInterface
- [THRIFT-5754]https://issues.apache.org/jira/browse/THRIFT-5754 - Fix PHP 8.1 deprecates passing null to non-nullable internal function parameters
- [THRIFT-5753]https://issues.apache.org/jira/browse/THRIFT-5753 - PHP 8.1 deprecated warning about return type in jsonSerialize functions

### Python

- [THRIFT-5688]https://issues.apache.org/jira/browse/THRIFT-5688 - Add PyPI publishing github actions

## 0.19.0

### Known Open Issues (Blocker or Critical)
Expand Down
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ EXTRA_DIST = \
.flake8 \
.gitattributes \
.gitignore \
.github/dependabot.yml \
.github/pull_request_template.md \
.github/stale.yml \
.github/workflows/build.yml \
.github/workflows/cmake.yml \
.github/workflows/pypi.yml \
.travis.yml \
ApacheThrift.nuspec \
appveyor.yml \
Expand Down
17 changes: 14 additions & 3 deletions compiler/cpp/src/thrift/generate/t_kotlin_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ void t_kotlin_generator::generate_service_processor(t_service* tservice) {
"org.apache.thrift.AsyncProcessFunction<"
<< tservice->get_name()
<< ", out org.apache.thrift.TBase<*, "
"*>, out kotlin.Any>> = mapOf("
"*>, out kotlin.Any, out org.apache.thrift.TBase<*, *>>> = mapOf("
<< endl;
indent_up();
{
Expand Down Expand Up @@ -1656,16 +1656,27 @@ void t_kotlin_generator::generate_service_process_function(ostream& out,
t_function* tfunc) {
string args_name = tservice->get_name() + "FunctionArgs." + tfunc->get_name() + "_args";
string rtype = type_name(tfunc->get_returntype(), true);
string resultname = tservice->get_name() + "FunctionResult." + tfunc->get_name() + "_result";

indent(out) << "class " << tfunc->get_name() << "<I : " << tservice->get_name()
<< ">(private val scope: kotlinx.coroutines.CoroutineScope) : "
"org.apache.thrift.AsyncProcessFunction<I, "
<< args_name << ", " << rtype << ">(\"" << tfunc->get_name()
<< "\"), ProcessFunction {" << endl;
<< args_name << ", " << rtype << ", "
<< (tfunc->is_oneway() ? "org.apache.thrift.TBase<*, *>" : resultname)
<< ">(\"" << tfunc->get_name() << "\"), ProcessFunction {"
<< endl;
indent_up();
{
indent(out) << "override fun isOneway() = " << (tfunc->is_oneway() ? "true" : "false") << endl;
indent(out) << "override fun getEmptyArgsInstance() = " << args_name << "()" << endl;
indent(out) << "override fun getEmptyResultInstance() = ";
if (tfunc->is_oneway()) {
out << "null" << endl;
}
else {
out << resultname << "()" << endl;
}
indent(out) << endl;
indent(out) << "override fun start(iface: I, args: " << args_name
<< ", resultHandler: org.apache.thrift.async.AsyncMethodCallback<" << rtype
<< ">) {" << endl;
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
thrift (0.20.0) stable; urgency=low

* update to 0.20.0

-- Apache Thrift Developers <dev@thrift.apache.org> Sat, 04 Feb 2024 14:55:00 +0100

thrift (0.19.0) stable; urgency=low

* update to 0.19.0
Expand Down
11 changes: 8 additions & 3 deletions doap.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,22 @@
<release rdf:parseType="Collection">
<Version>
<name>Apache Thrift</name>
<created>2022-07-15</created>
<created>2024-02-04</created>
<revision>0.20.0</revision>
</Version>
<Version>
<name>Apache Thrift</name>
<created>2023-07-15</created>
<revision>0.19.0</revision>
</Version>
<Version>
<name>Apache Thrift</name>
<created>2022-02-15</created>
<created>2023-02-15</created>
<revision>0.18.1</revision>
</Version>
<Version>
<name>Apache Thrift</name>
<created>2022-02-06</created>
<created>2023-02-06</created>
<revision>0.18.0</revision>
</Version>
<Version>
Expand Down
2 changes: 2 additions & 0 deletions lib/go/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ EXTRA_DIST = \
dontexportrwtest \
tests \
common \
go.mod \
go.sum \
BinaryKeyTest.thrift \
ClientMiddlewareExceptionTest.thrift \
ConflictArgNamesTest.thrift \
Expand Down
142 changes: 70 additions & 72 deletions lib/java/src/main/java/org/apache/thrift/ProcessFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,90 +9,88 @@
import org.slf4j.LoggerFactory;

public abstract class ProcessFunction<I, T extends TBase, A extends TBase> {
private final String methodName;
private final String methodName;

private static final Logger LOGGER = LoggerFactory.getLogger(ProcessFunction.class.getName());
private static final Logger LOGGER = LoggerFactory.getLogger(ProcessFunction.class.getName());

public ProcessFunction(String methodName) {
this.methodName = methodName;
}

public final void process(int seqid, TProtocol iprot, TProtocol oprot, I iface)
throws TException {
T args = getEmptyArgsInstance();
try {
args.read(iprot);
} catch (TProtocolException e) {
iprot.readMessageEnd();
TApplicationException x =
new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return;
}
iprot.readMessageEnd();
TSerializable result = null;
byte msgType = TMessageType.REPLY;
public ProcessFunction(String methodName) {
this.methodName = methodName;
}

try {
result = getResult(iface, args);
} catch (TTransportException ex) {
LOGGER.error("Transport error while processing " + getMethodName(), ex);
throw ex;
} catch (TApplicationException ex) {
LOGGER.error("Internal application error processing " + getMethodName(), ex);
result = ex;
msgType = TMessageType.EXCEPTION;
} catch (Exception ex) {
LOGGER.error("Internal error processing " + getMethodName(), ex);
if (rethrowUnhandledExceptions()) throw new RuntimeException(ex.getMessage(), ex);
if (!isOneway()) {
result =
new TApplicationException(
TApplicationException.INTERNAL_ERROR,
"Internal error processing " + getMethodName());
msgType = TMessageType.EXCEPTION;
}
}
public final void process(int seqid, TProtocol iprot, TProtocol oprot, I iface)
throws TException {
T args = getEmptyArgsInstance();
try {
args.read(iprot);
} catch (TProtocolException e) {
iprot.readMessageEnd();
TApplicationException x =
new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage());
oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
return;
}
iprot.readMessageEnd();
TSerializable result = null;
byte msgType = TMessageType.REPLY;

if (!isOneway()) {
oprot.writeMessageBegin(new TMessage(getMethodName(), msgType, seqid));
result.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
try {
result = getResult(iface, args);
} catch (TTransportException ex) {
LOGGER.error("Transport error while processing " + getMethodName(), ex);
throw ex;
} catch (TApplicationException ex) {
LOGGER.error("Internal application error processing " + getMethodName(), ex);
result = ex;
msgType = TMessageType.EXCEPTION;
} catch (Exception ex) {
LOGGER.error("Internal error processing " + getMethodName(), ex);
if (rethrowUnhandledExceptions()) throw new RuntimeException(ex.getMessage(), ex);
if (!isOneway()) {
result =
new TApplicationException(
TApplicationException.INTERNAL_ERROR,
"Internal error processing " + getMethodName());
msgType = TMessageType.EXCEPTION;
}
}

private void handleException(int seqid, TProtocol oprot) throws TException {
if (!isOneway()) {
TApplicationException x =
new TApplicationException(
TApplicationException.INTERNAL_ERROR, "Internal error processing " + getMethodName());
oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
if (!isOneway()) {
oprot.writeMessageBegin(new TMessage(getMethodName(), msgType, seqid));
result.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
}

protected boolean rethrowUnhandledExceptions() {
return false;
private void handleException(int seqid, TProtocol oprot) throws TException {
if (!isOneway()) {
TApplicationException x =
new TApplicationException(
TApplicationException.INTERNAL_ERROR, "Internal error processing " + getMethodName());
oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.EXCEPTION, seqid));
x.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
}
}

public abstract boolean isOneway();
protected boolean rethrowUnhandledExceptions() {
return false;
}

public abstract TBase<?, ?> getResult(I iface, T args) throws TException;
public abstract boolean isOneway();

public abstract T getEmptyArgsInstance();
public abstract TBase<?, ?> getResult(I iface, T args) throws TException;

/**
* Returns null when this is a oneWay function.
*/
public abstract A getEmptyResultInstance();
public abstract T getEmptyArgsInstance();

public String getMethodName() {
return methodName;
}
/** Returns null when this is a oneWay function. */
public abstract A getEmptyResultInstance();

public String getMethodName() {
return methodName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ public class TBaseAsyncProcessor<I> implements TAsyncProcessor, TProcessor {
final Map<String, AsyncProcessFunction<I, ? extends TBase, ?, ? extends TBase>> processMap;

public TBaseAsyncProcessor(
I iface, Map<String, AsyncProcessFunction<I, ? extends TBase, ?, ? extends TBase>> processMap) {
I iface,
Map<String, AsyncProcessFunction<I, ? extends TBase, ?, ? extends TBase>> processMap) {
this.iface = iface;
this.processMap = processMap;
}

public Map<String, AsyncProcessFunction<I, ? extends TBase, ?, ? extends TBase>> getProcessMapView() {
public Map<String, AsyncProcessFunction<I, ? extends TBase, ?, ? extends TBase>>
getProcessMapView() {
return Collections.unmodifiableMap(processMap);
}

Expand Down
3 changes: 2 additions & 1 deletion lib/java/src/main/java/org/apache/thrift/TBaseProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public abstract class TBaseProcessor<I> implements TProcessor {
private final Map<String, ProcessFunction<I, ? extends TBase, ? extends TBase>> processMap;

protected TBaseProcessor(
I iface, Map<String, ProcessFunction<I, ? extends TBase, ? extends TBase>> processFunctionMap) {
I iface,
Map<String, ProcessFunction<I, ? extends TBase, ? extends TBase>> processFunctionMap) {
this.iface = iface;
this.processMap = processFunctionMap;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/netstd/Thrift/Thrift.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<PackageTags>Apache Thrift RPC</PackageTags>
<PackageReleaseNotes>https://github.com/apache/thrift/blob/0.21.0/CHANGES.md</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Copyright>Copyright 2023 The Apache Software Foundation</Copyright>
<Copyright>Copyright 2024 The Apache Software Foundation</Copyright>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ EXTRA_DIST = \
AnnotationTest.thrift \
BrokenConstants.thrift \
ConstantsDemo.thrift \
v0.16/ConstantsDemo.thrift \
DebugProtoTest.thrift \
v0.16/DebugProtoTest.thrift \
DenseLinkingTest.thrift \
Expand All @@ -159,6 +160,7 @@ EXTRA_DIST = \
ManyOptionals.thrift \
ManyTypedefs.thrift \
NameConflictTest.thrift \
v0.16/NameConflictTest.thrift \
OptionalRequiredTest.thrift \
Recursive.thrift \
ReuseObjects.thrift \
Expand Down
2 changes: 2 additions & 0 deletions test/go/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ genmock: gopath
EXTRA_DIST = \
src/bin \
src/common \
go.mod \
go.sum \
genmock.sh
Loading

0 comments on commit 045fe74

Please sign in to comment.