JDK Native Code Implementation - jvm

I would like to know if it is possible to get the Native Code implementation of JDK methods, such as:
public final class System {
/* First thing---register the natives */
private static native void registerNatives();
...
....}

Search for OpenJDK source code (it is open source), or any other open-source Java implementation and you can find the implementations.
The System class source for example (grabbing the complete OpenJDK source might be more convenient than this 'web view').
Note: registerNatives() is using native (C/C++ ?) code, so you'd need to track that down (from the complete source code for example). Or any other implementation you are interested in.

Above part of code is not enough to implement native method, you can find detailed information http://www.javaworld.com/javatips/jw-javatip23.html

All this is available from the OpenJDK Mercurial repo web view, but it is far from trivial to track down.
This here is a link to java.lang.System native code in the newest development version of JDK 7 Update stream. Hopefully you'll find your way around from there.

Related

Unable to import os.log in Kotlin Multiplatform

I am trying to implement kotlin multiplaform logger. During the implementation of iOS architecture, I couldn't import os.log to use os_log. How could I do this or what else can I use to log in iOS in Kotlin Multiplatform project?
The problem is that the OSLog class has only Swift API: see here. As Kotlin/Native does not provide direct interoperability, some frameworks are unavailable(see the same problem with SwiftUI for example). The best option you have out-of-the-box is to use NSLog, as Philip suggests, or to use some third-party library. There is a resource with a list of popular Kotlin Multiplatform libraries: https://github.com/AAkira/Kotlin-Multiplatform-Libraries#logging. It might be a good place to start. Two important things to note about this:
This list does not include all libraries. For sure, there are some nice libs that are not included yet.
I'm recommending it as an entry point to the community. Philips' advice is pretty good, and maybe there are some other approaches that can be seen across the libs or in the kotlinlang Slack.
You can simply use kotlin println, also in iOS part you can use platform.Foundation.NSLog for formatter output

How can I distribute my objective c library with source code embedded

I would like for people to be able to debug my library, should they feel like they want to.
For this I think a good idea would be to embed the source in the library / framework itself. Does Xcode support this option?
For reference of what I’m looking for, in Java you can build a Jar file which comes with the attached source code (and optional javadoc) embedded within the library https://stackoverflow.com/a/5064833/48062
Xcode does not support this option, no. Your best bet would be to upload the source to Github (https://github.com) and include the link in your documentation for the framework. That way you can be sure that your users can always get to the freshest, most up to date, code.

xamarin get location at cross-platform

i want to get location (use gps) at xamarin.form - that is, in cross platform.
but i can't find. only platform-dependent (at android, at ios, etc.)
if you know, please share to me !
(i found xamarin.mobile - geolocation, but it is also platform-dependent T^T)
This is going to be device specific. Probably the best approach is to create an Interface in your portable class library and then implement the interface in your Android and iOS -specific projects. The PCL will connect to the implementation through the Xamarin Forms DependencyService. Please have a look at the following link Accessing Native Features via the DependencyService
It is likely that you will be able to use the other examples on the Xamarin site to write your platform-specific code. For example here is a link to the Android LocationService
Checkout Forms Labs. It should be pretty simple to reuse it even without Xamarin.Forms (if that's the case).

How check the availably of all objective-c function in source code for Cocoa

When you read the Class Reference of every object of iOS, you will find:
Available in iOS 2.0 and later.
There are a program or a way to list all function and the minimum iOS system?
How can I know if the iPhone with iOS 3.0 will run all iOS function? I can check it in runtime with respondToSelector, but can be more easy with source code?
Set your project's base SDK to iOS 3, and see if it builds.
AFAIK there is no way to list all the APIs you use in your app into one list and check that you are building past the minimum for all those APIs. You will just have to check each one, one by one. Highlight the API in Xcode, and then click escape and it will tell you very easily.
But also I have to mention that this won't be extremely necessary since you should test on the minimum OS you are building for and if it crashes at any point then you have your issue for that certain API.

Is there a Maven plugin to generate AS3 classes from Java for BlazeDS?

I'm looking for a maven plugin that would generate ActionScript3 classes from Java classes in order to access them by object remoting.
I've seen FlexMojo but it uses the GraniteDS generator which create some problems when it comes to map Enum objects (which can be fix through a workaround that is describe here : http://dev.c-ware.de/confluence/display/PUBLIC/Flexmojos+generated+AS3+model+with+Enum+support+using+BlazeDS?focusedCommentId=7634946&#comment-7634946 if you've googled your way here this might be useful) when working with BlazeDS.
Everything that I found so far are people who explain how to generate VO classes on flex side using Flash Builder 4, but this solution can not be used in an industrial development environment.
Take a look also on http://flex-annotations.aixcept.net/examples/actionscript.html
I also found this one, and while it is not a maven plug-in it could possibly be turned into one:
https://sourceforge.net/projects/cleartoolkit/
It was created by the guys who authored the book "Enterprise Development with Flex". Look for the utility DTO2Fx.