Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove URL stubs for 0.5.0 #2788

Merged
merged 2 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
143 changes: 143 additions & 0 deletions docs/changelog/0.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@

# 0.5.0-SNAPSHOT (mmm dd, 2022)

**WIP**

We are happy to announce the release of Scala Native 0.5.0!

Scala Native is an optimizing ahead-of-time compiler and lightweight managed runtime
designed specifically for Scala.
It is developed at the [Scala Center](https://scala.epfl.ch/) and with the help
from [VirtusLab](https://virtuslab.com) along with contributors from the community.

Check out the documentation at
[https://scala-native.readthedocs.io/](https://scala-native.readthedocs.io/en/latest)

## TL;DR
* **Not backward compatible with previous releases**,
* Removed `java.net.URL` and `java.net.URI.toURL` related stubs we don't plan to implement.

## Breaking changes
### Broken backward compatibility
Scala Native 0.5.0 breaks backward binary compatibility with previous releases of Scala Native.
Libraries published using version 0.4.x or older must be republished for Scala Native 0.5.x.

### Removal of `java.net` code
Some `java.net.URL` code was added as stubs to help out downstream projects. Java now has a HTTP
client so we don't plan to add the `URL` code to Scala Native.

Third-party libraries may add the removed code listed here into their projects
if they need it for linking.
```scala
package java.net

import scalanative.annotation.stub

class URL(from: String) {
@stub
def getPath(): java.lang.String = ???
@stub
def getProtocol(): java.lang.String = ???
@stub
def openConnection(): java.net.URLConnection = ???
@stub
def openStream(): java.io.InputStream = ???
@stub
override def hashCode: Int = ???
@stub
def toURI(): java.net.URI = ???
@stub
def toExternalForm(): java.lang.String = ???
}

package java.net

import scalanative.annotation.stub

class URLClassLoader(args: Array[Object], parent: ClassLoader)
extends ClassLoader(parent) {
@stub
def getURLs(): Array[Object] = ???
@stub
def close(): Unit = ???
}

package java.net

import scalanative.annotation.stub

class URLConnection {
@stub
def getLastModified(): scala.Long = ???
@stub
def connect(): Unit = ???
@stub
def getContentType(): String = ???
@stub
def getInputStream(): java.io.InputStream = ???
@stub
def setRequestProperty(key: String, value: String): Unit = ???
}
```
If we needed to support a third party library for URL we could follow our normal
extension method to add the following implementation in `java.net.URI` based on
Javadoc and JVM output:
```scala
@scalanative.annotation.stub
def toURL(): java.net.URL = if (this.isAbsolute()) {
new URL(this.toString)
} else {
throw new IllegalArgumentException("URI is not absolute")
}
```

### Other breaking changes:
* xxxx

## New features

### Supported Scala versions
We added ...

## Bugfixes
* xxx

## Contributors

Big thanks to everybody who contributed to this release or reported an issue!

```
$ git shortlog -sn --no-merges v0.4.x..v0.5.0

```

<table>
<tbody>
<tr>
<td>Merged PRs</td>
<td align="center"></td>
</tr>
<tr>
<td>Closed issues</td>
<td align="center"></td>
</tr>
<tr>
<td>Contributors</td>
<td align="center"></td>
</tr>
<tr>
</tbody>
</table>

[Full Changelog](https://github.com/scala-native/scala-native/compare/v0.4.x...v0.5.0)

### The most impacting merged pull requests:
#### Compiler

#### Sbt plugin

#### Native library

#### Java standard library


1 change: 1 addition & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
.. toctree::
:maxdepth: 1

0.5.0
0.4.5
0.4.4
0.4.3
Expand Down
3 changes: 0 additions & 3 deletions javalib/src/main/scala/java/net/URI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,4 @@ final class URI private () extends Comparable[URI] with Serializable {
}
convertHexToLowerCase(result.toString)
}

@scalanative.annotation.stub
def toURL(): java.net.URL = ???
}
20 changes: 0 additions & 20 deletions javalib/src/main/scala/java/net/URL.scala

This file was deleted.

11 changes: 0 additions & 11 deletions javalib/src/main/scala/java/net/URLClassLoader.scala

This file was deleted.

16 changes: 0 additions & 16 deletions javalib/src/main/scala/java/net/URLConnection.scala

This file was deleted.