Skip to content

[Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods to avoid conflicts. #19295

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

Merged

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Sep 13, 2018

These classes and methods would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.

rdar://problem/35768222

…thods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.

rdar://problem/35768222
@mikeash
Copy link
Contributor Author

mikeash commented Sep 13, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 798edb9

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 798edb9

@parkera
Copy link
Contributor

parkera commented Sep 18, 2018

Do you think it might be useful to use something besides an additional _ to indicate new vs old? That could get extremely confusing when looking at backtraces or other metadata.

@mikeash
Copy link
Contributor Author

mikeash commented Sep 19, 2018

I'm torn between the desire to more clearly distinguish between old and new, and the desire to keep things short and simple for what will soon be the common case of only having the new stuff loaded. I don't want some ABIStableSwift prefix littering crash logs years down the line. If you have any ideas that would be a better compromise I'm open to ideas. I made a small script to handle the renaming so it's easy to redo it with a different scheme.

@parkera
Copy link
Contributor

parkera commented Sep 19, 2018

Maybe it would be sufficient to note somewhere near the @interface for these that the single-underscore version of that name is reserved for old runtimes, so we don't accidentally introduce a conflict sometime in the future.

@mikeash
Copy link
Contributor Author

mikeash commented Sep 19, 2018

That definitely sounds like a wise idea to me.

@mikeash
Copy link
Contributor Author

mikeash commented Sep 19, 2018

@mikeash
Copy link
Contributor Author

mikeash commented Sep 19, 2018

(I'm just checking to see if this will pass PR testing, I'll be sure to add those comments before I actually merge.)

…xplaining the rename and noting that the old name cannot be used due to conflicts.

rdar://problem/35768222
@mikeash
Copy link
Contributor Author

mikeash commented Sep 20, 2018

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 798edb9

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 798edb9

@mikeash
Copy link
Contributor Author

mikeash commented Sep 20, 2018

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 317451c

@mikeash
Copy link
Contributor Author

mikeash commented Sep 21, 2018

@mikeash
Copy link
Contributor Author

mikeash commented Sep 24, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 317451c

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 317451c

@mikeash mikeash force-pushed the rename-conflicting-classes-and-methods branch from 526c79f to 1fb165a Compare September 24, 2018 14:17
@mikeash
Copy link
Contributor Author

mikeash commented Sep 24, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 526c79facd0a60cd015d1aba869e42dbed6851d6

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 526c79facd0a60cd015d1aba869e42dbed6851d6

@mikeash
Copy link
Contributor Author

mikeash commented Sep 24, 2018

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 098884d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 098884d

@mikeash mikeash merged commit 01823ca into swiftlang:master Sep 24, 2018
mikeash added a commit to mikeash/swift that referenced this pull request Jan 15, 2019
…ames.

Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request swiftlang#19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
mikeash added a commit to mikeash/swift that referenced this pull request Jan 17, 2019
…ames.

Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request swiftlang#19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants