Merge branch 'v0.20.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright (C) 2010-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
#define JAVA_CLASS_HXX
|
#define JAVA_CLASS_HXX
|
||||||
|
|
||||||
#include "Ref.hxx"
|
#include "Ref.hxx"
|
||||||
|
#include "Exception.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ namespace Java {
|
|||||||
/**
|
/**
|
||||||
* Wrapper for a local "jclass" reference.
|
* Wrapper for a local "jclass" reference.
|
||||||
*/
|
*/
|
||||||
class Class : public Java::LocalRef<jclass> {
|
class Class : public LocalRef<jclass> {
|
||||||
public:
|
public:
|
||||||
Class(JNIEnv *env, jclass cls)
|
Class(JNIEnv *env, jclass cls)
|
||||||
:LocalRef<jclass>(env, cls) {}
|
:LocalRef<jclass>(env, cls) {}
|
||||||
@@ -68,10 +69,8 @@ namespace Java {
|
|||||||
assert(name != nullptr);
|
assert(name != nullptr);
|
||||||
|
|
||||||
jclass cls = env->FindClass(name);
|
jclass cls = env->FindClass(name);
|
||||||
if (cls == nullptr) {
|
if (DiscardException(env))
|
||||||
env->ExceptionClear();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
Set(env, cls);
|
Set(env, cls);
|
||||||
env->DeleteLocalRef(cls);
|
env->DeleteLocalRef(cls);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2011 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace Java {
|
namespace Java {
|
||||||
|
Reference in New Issue
Block a user